SlideShare uma empresa Scribd logo
1 de 28
Dynamic Models
in Django
Juergen Schackmann
j.schackmann@reliatec.de
© Juergen Schackmann 2013 2/28
Me
▸ Python & Django since 4 years
▸ reliatec.de since 3 months
▸ Django Web Applications
▸ Focus: EDC systems for clinical studies & Telemonitoring
© Juergen Schackmann 2013 3/28
Objective
▸ Why do do we care about Django Dynamic Models?
▸ Why do we have to talk about them?
▸ What should we do about them?
Static vs Dynamic Models
© Juergen Schackmann 2013 5/28
Models in a Django project
Phase1:
Code Development
Models and model
attributes are defined by
implementing those with
Python code
Phase 2:
Deployment
Underlying database tables
and columns are created by
running “syncdb” command
Phase 3:
Runtime
Models / DB Tables are
populated with content as
part of the user
interactions
© Juergen Schackmann 2013 6/28
Problem?
There is no way to adapt the Django Models at runtime based on
user interactions
▸ Django Models are defined and implemented during
development phase
▸ Django Models are expected to be static after deployment
▸ Django DB Backends only fully support SQL databases, i.e. a
schema is required
▸ DB specific solutions limit adoption rate of any reusable App
Use Cases for Dynamic
Models
© Juergen Schackmann 2013 8/28
Custom Content Types for a CMS*
* system: dotCms (Java); source: http://dotcms.com/
© Juergen Schackmann 2013 9/28
Customized Products for an Ecommerce Shop*
* system: Magento (PHP); source: averybrandandprint.co.uk
© Juergen Schackmann 2013 10/28
Clinical Research Forms*
* system: OpenClinica (Java); source: openclinica.com
© Juergen Schackmann 2013 11/28
Problem? Which Problem?
▸ Models / Content Types are domain or site specific
▸ Neither realistic nor efficient to implement all thinkable content
types into a software product
▸ Configuration by subject-matter experts is better, than code
customization by developers
▸ Dynamic Models reduce the number of deployment cycles
Evaluation of
Patterns & Apps
© Juergen Schackmann 2013 13/28
As a User, I ...
▸ want to maintain my dynamic models easily without
understanding any Django Model details
▸ want extend existing (static) models without thinking about
static and dynamic parts
▸ do not want to think about performance, when creating my
custom fields
▸ I want to be able to query/search for certain information
seamlessly over static and dynamic models
© Juergen Schackmann 2013 14/28
As a developer, I ...
▸ want my dynamic models to be integrated with Django Standard
Tools (admin, migrations, reversion) out of the box
▸ want to apply the same API that I use for the static models
▸ do not want to use or be limited to specific databases, but use
the standard Django backends
▸ want to have a customizable front-end for my users to manage
the dynamic models
© Juergen Schackmann 2013 15/28
Evaluation Criteria
▸ Performance
▸ “Querybility”
▸ Django Standard Tools Integration (Admin, Cache, ...)
▸ Supported Backend
▸ Complexity/ Maintainability
© Juergen Schackmann 2013 16/28
Entity Attribute Value (EAV)
Transform your table columns into table rows
Attribute 1 Attribute 2 Attribute n
Table
Attribute
Name
Attribute
Value
Attribute
TableTable has1 n
© Juergen Schackmann 2013 17/28
EAV Django Apps
▸ bitbucket.org/neithere/eav-django/
▸ github.com/mvpdev/django-eav
© Juergen Schackmann 2013 18/28
Serialized Dictionary
Transform your table columns into pickeld or jsoned dictionaries
Attribute 1 Attribute 2 Attribute n
Table
Dictionary
String
Attributes
{“attribute1”:”a”, “attribute2”: 5, “attribute3”:[1,2] }
© Juergen Schackmann 2013 19/28
Serialized Dictionary Django Apps
Fields
▸ bitbucket.org/schinckel/django-jsonfield/
▸ github.com/bradjasper/django-jsonfield
▸ github.com/derek-schaefer/django-json-field
▸ github.com/shrubberysoft/django-picklefield
App
▸ github.com/dobarkod/django-dynamic-model
© Juergen Schackmann 2013 20/28
Runtime Schema Updates
Update Django models and database schema at runtime using
▸ syncdb functionality
▸ South functionality
▸ eventually: Andrew Godwin's “Schema Migrations for Django”
© Juergen Schackmann 2013 21/28
Runtime Schema Update Django Apps
Update Django models and database schema at runtime using
▸ Syncdb
▸ bitbucket.org/mhall119/dynamo/overview
▸ South
▸ github.com/willhardy/dynamic-models
▸ github.com/willhardy/django-dymo
▸ bitbucket.org/schacki/django-dynamo
▸ github.com/charettes/django-mutant
▸ Schema Migrations
▸ github.com/charettes/django-mutant
© Juergen Schackmann 2013 22/28
Database specific solutions
Hstore
▸ github.com/jordanm/django-hstore
▸ postgresql.org/docs/9.0/static/hstore.html
No SQL
▸ github.com/django-nonrel
▸ github.com/pydanny/django-mongonaut
© Juergen Schackmann 2013 23/28
Summary
EAV Serialization Schema Updates
Performance   
Querybility   
Django Standard
Tools
 / 
Supported
Backend
  
Complexity/
Maintainability
  
© Juergen Schackmann 2013 24/28
Schema Update most powerful, but ...
▸ Name clashes between developer models and dynamic models
(especially with schema migrations)
▸ Multiple Users updating the same model (possibly even
conflicting)
▸ Orphan database elements
▸ Dynamic Model loading at startup
▸ How to find/inject dynamic models into views and templates
Components of a
Dynamic Model App
© Juergen Schackmann 2013 26/28
Must have components of a Dynamic Model
Application
▸ Meta Model Front End to let users maintain their meta models
▸ Meta Model Representation to store the meta model information
▸ Meta Model Analyzer to detect changes that require some further
actions (for schema, admin or model)
▸ Schema Sync Manager to update and sync the database schema
▸ Admin Sync Manager to update and sync the Django admin
▸ Model/Cache Sync Manager to update and sync the Django models
and model cache
© Juergen Schackmann 2013 27/28
More resources on dynamic models
▸ code.djangoproject.com/wiki/DynamicModels
▸ djangopackages.com/grids/g/forms/
▸ stackoverflow.com/questions/7933596/django-dynamic-model-
fields/7934577
Thank you very much!
Questions please?

Mais conteúdo relacionado

Mais procurados

Sap interface overview
Sap interface overviewSap interface overview
Sap interface overview
gnareshmbacwa
 
Step by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAPStep by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAP
nityaabap
 
System Analysis and Design Project
System Analysis and Design ProjectSystem Analysis and Design Project
System Analysis and Design Project
Siddharth Shah
 

Mais procurados (20)

Sap interface overview
Sap interface overviewSap interface overview
Sap interface overview
 
Cloud Foundry Monitoring How-To: Collecting Metrics and Logs
Cloud Foundry Monitoring How-To: Collecting Metrics and LogsCloud Foundry Monitoring How-To: Collecting Metrics and Logs
Cloud Foundry Monitoring How-To: Collecting Metrics and Logs
 
Principal Propagation with SAP Cloud Platform
Principal Propagation with SAP Cloud PlatformPrincipal Propagation with SAP Cloud Platform
Principal Propagation with SAP Cloud Platform
 
Peoplesoft AWE_hcm_delegation_framework
Peoplesoft  AWE_hcm_delegation_frameworkPeoplesoft  AWE_hcm_delegation_framework
Peoplesoft AWE_hcm_delegation_framework
 
2015 04 Preparing for the SAP S/4HANA Migration
2015 04 Preparing for the SAP S/4HANA Migration2015 04 Preparing for the SAP S/4HANA Migration
2015 04 Preparing for the SAP S/4HANA Migration
 
SAP BPC Embedded for S/4 HANA
SAP BPC Embedded for S/4 HANASAP BPC Embedded for S/4 HANA
SAP BPC Embedded for S/4 HANA
 
Various Table Partitioning in SAP HANA
Various Table Partitioning in SAP HANAVarious Table Partitioning in SAP HANA
Various Table Partitioning in SAP HANA
 
S4HANA Migration Overview
S4HANA Migration OverviewS4HANA Migration Overview
S4HANA Migration Overview
 
Step by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAPStep by Step guide for creating first ABAP report in SAP
Step by Step guide for creating first ABAP report in SAP
 
SSL Configuration within SAP HANA
SSL Configuration within SAP HANASSL Configuration within SAP HANA
SSL Configuration within SAP HANA
 
Aris client installation guide
Aris client installation guideAris client installation guide
Aris client installation guide
 
On-line book store presentation
On-line book store presentation On-line book store presentation
On-line book store presentation
 
Maximizing SAP ABAP Performance
Maximizing SAP ABAP PerformanceMaximizing SAP ABAP Performance
Maximizing SAP ABAP Performance
 
SAP S/4HANA: Finance Capability and Frequently Asked Questions
SAP S/4HANA: Finance Capability and Frequently Asked QuestionsSAP S/4HANA: Finance Capability and Frequently Asked Questions
SAP S/4HANA: Finance Capability and Frequently Asked Questions
 
SAP EASY DMS
SAP EASY DMSSAP EASY DMS
SAP EASY DMS
 
Sap s4 hana (2)
Sap s4 hana (2)Sap s4 hana (2)
Sap s4 hana (2)
 
System Analysis and Design Project
System Analysis and Design ProjectSystem Analysis and Design Project
System Analysis and Design Project
 
Sap enterprise asset_management
Sap enterprise asset_managementSap enterprise asset_management
Sap enterprise asset_management
 
BAPI - Criação de Ordem de Manutenção
BAPI - Criação de Ordem de ManutençãoBAPI - Criação de Ordem de Manutenção
BAPI - Criação de Ordem de Manutenção
 
Abap proxy
Abap proxyAbap proxy
Abap proxy
 

Destaque

The django book - Chap10 : Advanced Models
The django book - Chap10 : Advanced ModelsThe django book - Chap10 : Advanced Models
The django book - Chap10 : Advanced Models
Spin Lai
 
Building Dynamic Websites With Joomla CMS
Building Dynamic Websites With Joomla CMSBuilding Dynamic Websites With Joomla CMS
Building Dynamic Websites With Joomla CMS
Thomas Siegers
 
International marketing (1)
International marketing (1)International marketing (1)
International marketing (1)
Ganpurev Ganbold
 

Destaque (15)

Developing a Solid Content Strategy
Developing a Solid Content StrategyDeveloping a Solid Content Strategy
Developing a Solid Content Strategy
 
EDF2013: Big Data Tutorial: Marko Grobelnik
EDF2013: Big Data Tutorial: Marko GrobelnikEDF2013: Big Data Tutorial: Marko Grobelnik
EDF2013: Big Data Tutorial: Marko Grobelnik
 
Semantic Wiki For The Enterprise
Semantic Wiki For The EnterpriseSemantic Wiki For The Enterprise
Semantic Wiki For The Enterprise
 
Cognos Software Development Kit
Cognos Software Development KitCognos Software Development Kit
Cognos Software Development Kit
 
The django book - Chap10 : Advanced Models
The django book - Chap10 : Advanced ModelsThe django book - Chap10 : Advanced Models
The django book - Chap10 : Advanced Models
 
Building Dynamic Websites With Joomla CMS
Building Dynamic Websites With Joomla CMSBuilding Dynamic Websites With Joomla CMS
Building Dynamic Websites With Joomla CMS
 
Integrating CMS and eCommerce platforms
Integrating CMS and eCommerce platformsIntegrating CMS and eCommerce platforms
Integrating CMS and eCommerce platforms
 
Django rest framework tips and tricks
Django rest framework   tips and tricksDjango rest framework   tips and tricks
Django rest framework tips and tricks
 
IBM Cognos TM1 Version 10.1 Demonstration and Financial Planning Best Practic...
IBM Cognos TM1 Version 10.1 Demonstration and Financial Planning Best Practic...IBM Cognos TM1 Version 10.1 Demonstration and Financial Planning Best Practic...
IBM Cognos TM1 Version 10.1 Demonstration and Financial Planning Best Practic...
 
Marketing Management Notes Unit I
Marketing Management Notes   Unit   IMarketing Management Notes   Unit   I
Marketing Management Notes Unit I
 
What is a Content Management System or CMS
What is a Content Management System or CMSWhat is a Content Management System or CMS
What is a Content Management System or CMS
 
International marketing (1)
International marketing (1)International marketing (1)
International marketing (1)
 
An Overview of Models in Django
An Overview of Models in DjangoAn Overview of Models in Django
An Overview of Models in Django
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 

Semelhante a Dynamic Models with Django

Customizing the Django Admin
Customizing the Django AdminCustomizing the Django Admin
Customizing the Django Admin
Lincoln Loop
 
Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2
Alessandro Molina
 

Semelhante a Dynamic Models with Django (20)

Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Introduction to django framework
Introduction to django frameworkIntroduction to django framework
Introduction to django framework
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Graph Gurus 15: Introducing TigerGraph 2.4
Graph Gurus 15: Introducing TigerGraph 2.4 Graph Gurus 15: Introducing TigerGraph 2.4
Graph Gurus 15: Introducing TigerGraph 2.4
 
Droidcon Paris 2015
Droidcon Paris 2015Droidcon Paris 2015
Droidcon Paris 2015
 
Customizing the Django Admin
Customizing the Django AdminCustomizing the Django Admin
Customizing the Django Admin
 
Agile methodologiesvswaterfall
Agile methodologiesvswaterfallAgile methodologiesvswaterfall
Agile methodologiesvswaterfall
 
Drools & jBPM Workshop London 2013
Drools & jBPM Workshop London 2013Drools & jBPM Workshop London 2013
Drools & jBPM Workshop London 2013
 
Web Traffic Time Series Forecasting
Web Traffic  Time Series ForecastingWeb Traffic  Time Series Forecasting
Web Traffic Time Series Forecasting
 
Django interview Questions| Edureka
Django interview  Questions| EdurekaDjango interview  Questions| Edureka
Django interview Questions| Edureka
 
TextEditor - Designing open source apps
TextEditor - Designing open source appsTextEditor - Designing open source apps
TextEditor - Designing open source apps
 
The MEAN stack - SoCalCodeCamp - june 29th 2014
The MEAN stack - SoCalCodeCamp - june 29th 2014The MEAN stack - SoCalCodeCamp - june 29th 2014
The MEAN stack - SoCalCodeCamp - june 29th 2014
 
Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2Rapid Prototyping with TurboGears2
Rapid Prototyping with TurboGears2
 
Bootiful Reactive Testing - Mario Gray
Bootiful Reactive Testing - Mario GrayBootiful Reactive Testing - Mario Gray
Bootiful Reactive Testing - Mario Gray
 
Types of models
Types of modelsTypes of models
Types of models
 
How To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test AutomationHow To Transform the Manual Testing Process to Incorporate Test Automation
How To Transform the Manual Testing Process to Incorporate Test Automation
 
Agile - Scrum Presentation
Agile - Scrum PresentationAgile - Scrum Presentation
Agile - Scrum Presentation
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
What are the basic key points to focus on while learning Full-stack web devel...
What are the basic key points to focus on while learning Full-stack web devel...What are the basic key points to focus on while learning Full-stack web devel...
What are the basic key points to focus on while learning Full-stack web devel...
 
Django Workflow and Architecture
Django Workflow and ArchitectureDjango Workflow and Architecture
Django Workflow and Architecture
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 

Dynamic Models with Django

  • 1. Dynamic Models in Django Juergen Schackmann j.schackmann@reliatec.de
  • 2. © Juergen Schackmann 2013 2/28 Me ▸ Python & Django since 4 years ▸ reliatec.de since 3 months ▸ Django Web Applications ▸ Focus: EDC systems for clinical studies & Telemonitoring
  • 3. © Juergen Schackmann 2013 3/28 Objective ▸ Why do do we care about Django Dynamic Models? ▸ Why do we have to talk about them? ▸ What should we do about them?
  • 5. © Juergen Schackmann 2013 5/28 Models in a Django project Phase1: Code Development Models and model attributes are defined by implementing those with Python code Phase 2: Deployment Underlying database tables and columns are created by running “syncdb” command Phase 3: Runtime Models / DB Tables are populated with content as part of the user interactions
  • 6. © Juergen Schackmann 2013 6/28 Problem? There is no way to adapt the Django Models at runtime based on user interactions ▸ Django Models are defined and implemented during development phase ▸ Django Models are expected to be static after deployment ▸ Django DB Backends only fully support SQL databases, i.e. a schema is required ▸ DB specific solutions limit adoption rate of any reusable App
  • 7. Use Cases for Dynamic Models
  • 8. © Juergen Schackmann 2013 8/28 Custom Content Types for a CMS* * system: dotCms (Java); source: http://dotcms.com/
  • 9. © Juergen Schackmann 2013 9/28 Customized Products for an Ecommerce Shop* * system: Magento (PHP); source: averybrandandprint.co.uk
  • 10. © Juergen Schackmann 2013 10/28 Clinical Research Forms* * system: OpenClinica (Java); source: openclinica.com
  • 11. © Juergen Schackmann 2013 11/28 Problem? Which Problem? ▸ Models / Content Types are domain or site specific ▸ Neither realistic nor efficient to implement all thinkable content types into a software product ▸ Configuration by subject-matter experts is better, than code customization by developers ▸ Dynamic Models reduce the number of deployment cycles
  • 13. © Juergen Schackmann 2013 13/28 As a User, I ... ▸ want to maintain my dynamic models easily without understanding any Django Model details ▸ want extend existing (static) models without thinking about static and dynamic parts ▸ do not want to think about performance, when creating my custom fields ▸ I want to be able to query/search for certain information seamlessly over static and dynamic models
  • 14. © Juergen Schackmann 2013 14/28 As a developer, I ... ▸ want my dynamic models to be integrated with Django Standard Tools (admin, migrations, reversion) out of the box ▸ want to apply the same API that I use for the static models ▸ do not want to use or be limited to specific databases, but use the standard Django backends ▸ want to have a customizable front-end for my users to manage the dynamic models
  • 15. © Juergen Schackmann 2013 15/28 Evaluation Criteria ▸ Performance ▸ “Querybility” ▸ Django Standard Tools Integration (Admin, Cache, ...) ▸ Supported Backend ▸ Complexity/ Maintainability
  • 16. © Juergen Schackmann 2013 16/28 Entity Attribute Value (EAV) Transform your table columns into table rows Attribute 1 Attribute 2 Attribute n Table Attribute Name Attribute Value Attribute TableTable has1 n
  • 17. © Juergen Schackmann 2013 17/28 EAV Django Apps ▸ bitbucket.org/neithere/eav-django/ ▸ github.com/mvpdev/django-eav
  • 18. © Juergen Schackmann 2013 18/28 Serialized Dictionary Transform your table columns into pickeld or jsoned dictionaries Attribute 1 Attribute 2 Attribute n Table Dictionary String Attributes {“attribute1”:”a”, “attribute2”: 5, “attribute3”:[1,2] }
  • 19. © Juergen Schackmann 2013 19/28 Serialized Dictionary Django Apps Fields ▸ bitbucket.org/schinckel/django-jsonfield/ ▸ github.com/bradjasper/django-jsonfield ▸ github.com/derek-schaefer/django-json-field ▸ github.com/shrubberysoft/django-picklefield App ▸ github.com/dobarkod/django-dynamic-model
  • 20. © Juergen Schackmann 2013 20/28 Runtime Schema Updates Update Django models and database schema at runtime using ▸ syncdb functionality ▸ South functionality ▸ eventually: Andrew Godwin's “Schema Migrations for Django”
  • 21. © Juergen Schackmann 2013 21/28 Runtime Schema Update Django Apps Update Django models and database schema at runtime using ▸ Syncdb ▸ bitbucket.org/mhall119/dynamo/overview ▸ South ▸ github.com/willhardy/dynamic-models ▸ github.com/willhardy/django-dymo ▸ bitbucket.org/schacki/django-dynamo ▸ github.com/charettes/django-mutant ▸ Schema Migrations ▸ github.com/charettes/django-mutant
  • 22. © Juergen Schackmann 2013 22/28 Database specific solutions Hstore ▸ github.com/jordanm/django-hstore ▸ postgresql.org/docs/9.0/static/hstore.html No SQL ▸ github.com/django-nonrel ▸ github.com/pydanny/django-mongonaut
  • 23. © Juergen Schackmann 2013 23/28 Summary EAV Serialization Schema Updates Performance    Querybility    Django Standard Tools  /  Supported Backend    Complexity/ Maintainability   
  • 24. © Juergen Schackmann 2013 24/28 Schema Update most powerful, but ... ▸ Name clashes between developer models and dynamic models (especially with schema migrations) ▸ Multiple Users updating the same model (possibly even conflicting) ▸ Orphan database elements ▸ Dynamic Model loading at startup ▸ How to find/inject dynamic models into views and templates
  • 26. © Juergen Schackmann 2013 26/28 Must have components of a Dynamic Model Application ▸ Meta Model Front End to let users maintain their meta models ▸ Meta Model Representation to store the meta model information ▸ Meta Model Analyzer to detect changes that require some further actions (for schema, admin or model) ▸ Schema Sync Manager to update and sync the database schema ▸ Admin Sync Manager to update and sync the Django admin ▸ Model/Cache Sync Manager to update and sync the Django models and model cache
  • 27. © Juergen Schackmann 2013 27/28 More resources on dynamic models ▸ code.djangoproject.com/wiki/DynamicModels ▸ djangopackages.com/grids/g/forms/ ▸ stackoverflow.com/questions/7933596/django-dynamic-model- fields/7934577
  • 28. Thank you very much! Questions please?