DJANGO-HSTORE-
FLATTENFIELDS
campos dinâmicos sem nosql.
LUAN FONSECA E LUÍS ARAÚJO
MULTMEIO - NATAL RN
tecnologias
Python, Django, PostgreSql
DJANGO-REST-FRAMEWORK, HAYSTACK
Redis, Solr, Celery
Tornado, GEvent, Socket.IO, thoonk
AMAZON AWS, FABRIC, Apache,
LightHttp | NginX | Cherokee
Bootstrap, HighChart, Jquery
Python, Django, PostgreSql
DJANGO-REST-FRAMEWORK, HAYSTACK
Redis, Solr, Celery
Tornado, GEvent, Socket.IO, thoonk
AMAZON AWS, FABRIC, Apache,
LightHttp | NginX | Cherokee
Bootstrap, HighChart, Jquery
motivação
entidades com informações distintas em nível de instância.
- Redução no tempo de suporte
- Customização de crud, por parte do cliente
- dynamicfields looks like declaredfields
alternativas
PYTHON + django + MONGODB
- pymongo;
- mongoengine.
PYTHON + DJANGO + POSTGRESQL
- hstore extension;
- pgsql V9+.
RUBY + RAILS + MONGODB
features
modelforms, admin, queryset, Signals, tests, validations, constraints, actions (delete cascade...),.
''CAMPOS DINÂMICOS NOS MODELS.''
PYTHON + DJANGO + POSTGRESQL
- HSTORE EXTENSION;
- PGSQL V9+.
SELECT * FROM Person;
+---------------------------------------+
| Person |
+---------------------------------------+
| id | name | _dfields |
| 1 | Jesus | {'RG':'19216801'} |
| 2 | Maria | {'SEXO':'F'} |
| 3 | Jose | {'IDADE':'700'} |
| 4 | Jumento | {'autonomia':'4h'} |
+---------------------------------------+
- HSTORE EXTENSION;
- PGSQL V9+.
SELECT * FROM Person;
+---------------------------------------+
| Person |
+---------------------------------------+
| id | name | _dfields |
| 1 | Jesus | {'RG':'19216801'} |
| 2 | Maria | {'SEXO':'F'} |
| 3 | Jose | {'IDADE':'700'} |
| 4 | Jumento | {'autonomia':'4h'} |
+---------------------------------------+django model
class Person(HStoreModel):name = models.CharField(max_length=20)>>> p = Person.objects.create(name='Marvin', idade=42)>>> print p._dfields{'idade': u'42'}>>> p.idade42
queryset
>>> Person.objects.filter(idade__gte=21).count()=================================SELECT COUNT(*)FROM "person"WHERECAST(NULLIF("person"."_dfields"->'idade', '') AS integer) >= 21
Aplicação
zambÊ - rest - solr
Repositório
https://github.com/multmeio/django-hstore-flattenfields
contatos
HTTPS://github.com/caitifbrito
HTTPS://GITHUB.COM/luanfonceca
WE ARE HIRING!
MULTMEIO.COM.BR/VAGAS
Natal - RN
hstore-flattenfields
By Luan Fonseca de Farias
hstore-flattenfields
- 2,410