hasgeek / nodular

Reusable content objects for HasGeek apps
http://nodular.readthedocs.org/
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Use JsonDict for properties #14

Closed jace closed 8 years ago

jace commented 8 years ago

Properties are currently stored in a separate table. To retrieve properties for a given node, the database has to scan this table for properties that may be scattered all over.

However, since there is almost no use case for accessing properties without the associated node, we may be better off storing properties in a JsonDict (from coaster.sqlalchemy). This will use PostgreSQL's efficient JSONB store (or JSON on older versions), falling back to TEXT on other databases.

Should querying on the basis of properties be required, they can also be indexed in PostgreSQL.

This will switch will remove a lot of code that currently serves to make the Node.properties object behave like a dictionary.

jace commented 8 years ago

For reference: the property table was introduced in cee61e4fdc6271fc629435ab104a2a029b5dc3cd.