SlideShare a Scribd company logo
1 of 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?

More Related Content

What's hot

Introduction to Web Development Career
Introduction to Web Development CareerIntroduction to Web Development Career
Introduction to Web Development Career
Eunus Hosen
 

What's hot (20)

OFF PAGE SEO
OFF PAGE SEOOFF PAGE SEO
OFF PAGE SEO
 
Seo Presentation for Beginners, Complete SEO ppt,
Seo Presentation for Beginners, Complete SEO ppt,Seo Presentation for Beginners, Complete SEO ppt,
Seo Presentation for Beginners, Complete SEO ppt,
 
Mobile Browser Internal (Blink Rendering Engine)
Mobile Browser Internal (Blink Rendering Engine)Mobile Browser Internal (Blink Rendering Engine)
Mobile Browser Internal (Blink Rendering Engine)
 
Core web Vitals: Web Performance and Usability
Core web Vitals: Web Performance and UsabilityCore web Vitals: Web Performance and Usability
Core web Vitals: Web Performance and Usability
 
Introduction à JavaScript
Introduction à JavaScriptIntroduction à JavaScript
Introduction à JavaScript
 
Kotlin vs Java | Edureka
Kotlin vs Java | EdurekaKotlin vs Java | Edureka
Kotlin vs Java | Edureka
 
Top 10 Google Analytics Reports
Top 10 Google Analytics ReportsTop 10 Google Analytics Reports
Top 10 Google Analytics Reports
 
Web Page Speed - A Most Important Feature
Web Page Speed - A Most Important FeatureWeb Page Speed - A Most Important Feature
Web Page Speed - A Most Important Feature
 
Core Web Vitals - The Modern Web Experience
Core Web Vitals - The Modern Web ExperienceCore Web Vitals - The Modern Web Experience
Core Web Vitals - The Modern Web Experience
 
Google Tag Manager (GTM)
Google Tag Manager (GTM)Google Tag Manager (GTM)
Google Tag Manager (GTM)
 
Importance of Backlinks In SEO
Importance of Backlinks In SEOImportance of Backlinks In SEO
Importance of Backlinks In SEO
 
What is the best steps for seo ? ppt
What is the best steps for seo ? pptWhat is the best steps for seo ? ppt
What is the best steps for seo ? ppt
 
Introduction to Web Development Career
Introduction to Web Development CareerIntroduction to Web Development Career
Introduction to Web Development Career
 
Angular Introduction By Surekha Gadkari
Angular Introduction By Surekha GadkariAngular Introduction By Surekha Gadkari
Angular Introduction By Surekha Gadkari
 
SEO Audit Report | Analyze Website Free 2023
SEO Audit Report | Analyze Website Free 2023SEO Audit Report | Analyze Website Free 2023
SEO Audit Report | Analyze Website Free 2023
 
On-Page SEO
On-Page SEOOn-Page SEO
On-Page SEO
 
What is SEO? - Basic SEO Guide for Beginners.pptx
What is SEO? - Basic SEO Guide for Beginners.pptxWhat is SEO? - Basic SEO Guide for Beginners.pptx
What is SEO? - Basic SEO Guide for Beginners.pptx
 
Google Chrome Extensions - DevFest09
Google Chrome Extensions - DevFest09Google Chrome Extensions - DevFest09
Google Chrome Extensions - DevFest09
 
Screaming Frog PPT
Screaming Frog PPTScreaming Frog PPT
Screaming Frog PPT
 
Core Web Vitals Optimization for any website, especially WordPress
Core Web Vitals Optimization for any website, especially WordPressCore Web Vitals Optimization for any website, especially WordPress
Core Web Vitals Optimization for any website, especially WordPress
 

Viewers also liked

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
 

Viewers also liked (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
 

Similar to 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
 

Similar to 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
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

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?