User defined data schemas for applications

Manuel

I want to write an application that allows users to define their own data base schemas. The user provides a definition  using a DSL (biological experiments) and based on this, an oop/entity relation model is generated. The backend should be an RDBMS such as Postgres.

What is the best way to do this?

I can see two possible ways off the top of my head:

  1. Map types to SQL tables just like you would when writing a Django or Hibernate based application. Objects then map to table rows.
  2. Describe the types in an "type" table and objects in another table.

What do people generally do here? For 1., permission managent etc. could be handed to the rdbms. However how would one be able to track changes here and allow rollbacks?

Can anyone point me towards best practice?

Ken Clubok

Best practice depends much on your application's specific needs. For example, Option 1 is appropriate if you are writing an application generator with technically savvy and trustworthy users. This, for example, is the approach taken by PeopleSoft Application Designer. Tracking changes and allowing rollbacks is tricky, since you can't roll back something like a dropped column. You could write some complicated arrangement with a custom audit table to track what was done, and logic to make it reversible. But you would still lose data with that dropped column. If storage is no concern, you could make a backup copy of the table with each change, and the rollback would simply restore that backup. But then you would risk losing data that had been added to the table between the change and the rollback.

On the other hand, if what you are creating is more like a survey generator, then I have done something a little like option 2. Keep a metadata table that shows what a "record" is. The record itself is actually stored in two tables - parent and child. The parent table identifies the record, but all the fields are stored in the child table, as key-value pairs. You have complete flexibility to store whatever you want, and you never have to muck with dynamically changing the database schema. You can even preserve historical versions of the metadata, so that you can always reference historical records without losing data.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Adding User Defined data

From Dev

Write to user defined partition /data

From Dev

SQLite Querying with user defined data

From Dev

POI-XSSF: user defined data formats

From Dev

VBA data validation with user defined function

From Dev

Access data in a UDF (User Defined Function) in DocumentDB

From Dev

Aggregating Data in R with user defined function

From Dev

Pentaho Data Integration User Defined Java Class

From Dev

R data.table user defined function

From Dev

Javascript array inputing and display user defined data

From Dev

NumberFormat VBA With User-Defined Data

From Dev

User Defined Type with spring-data-cassandra

From Dev

Error creating the user defined data type

From Dev

How to Insert Data to the Database? - User Defined Classes

From Dev

Data extraction from user defined attribute

From Dev

User-Defined function with data table aggregation

From Java

haskell error change user input to user defined data type in function

From Dev

Calling User-Defined Function in select statement returning xml data

From Dev

does entity framework support User Defined Data Types?

From Dev

using user defined tables in SQL Stored Procedure - invalid data type

From Dev

What will happen if a user defined constructor omits initialization for data members?

From Dev

Two-Way Data Binding: View is missing user defined type

From Dev

user defined data integrity constraints in Neo4j

From Dev

c++ unordered_map for user defined data type

From Dev

Can i have a user defined value as a data type in json in golang

From Dev

How to rewrite no_data_found exception into a user-defined exception?

From Dev

Creating generators from user defined data types in haskell

From Dev

FSharp.Data.SqlClient Type Provider with User Defined table types

From Dev

storage duration of underlying character data with user-defined string literal

Related Related

  1. 1

    Adding User Defined data

  2. 2

    Write to user defined partition /data

  3. 3

    SQLite Querying with user defined data

  4. 4

    POI-XSSF: user defined data formats

  5. 5

    VBA data validation with user defined function

  6. 6

    Access data in a UDF (User Defined Function) in DocumentDB

  7. 7

    Aggregating Data in R with user defined function

  8. 8

    Pentaho Data Integration User Defined Java Class

  9. 9

    R data.table user defined function

  10. 10

    Javascript array inputing and display user defined data

  11. 11

    NumberFormat VBA With User-Defined Data

  12. 12

    User Defined Type with spring-data-cassandra

  13. 13

    Error creating the user defined data type

  14. 14

    How to Insert Data to the Database? - User Defined Classes

  15. 15

    Data extraction from user defined attribute

  16. 16

    User-Defined function with data table aggregation

  17. 17

    haskell error change user input to user defined data type in function

  18. 18

    Calling User-Defined Function in select statement returning xml data

  19. 19

    does entity framework support User Defined Data Types?

  20. 20

    using user defined tables in SQL Stored Procedure - invalid data type

  21. 21

    What will happen if a user defined constructor omits initialization for data members?

  22. 22

    Two-Way Data Binding: View is missing user defined type

  23. 23

    user defined data integrity constraints in Neo4j

  24. 24

    c++ unordered_map for user defined data type

  25. 25

    Can i have a user defined value as a data type in json in golang

  26. 26

    How to rewrite no_data_found exception into a user-defined exception?

  27. 27

    Creating generators from user defined data types in haskell

  28. 28

    FSharp.Data.SqlClient Type Provider with User Defined table types

  29. 29

    storage duration of underlying character data with user-defined string literal

HotTag

Archive