Giter Club home page Giter Club logo

modeler's Introduction

modeler

(Bi-temporal) data modelling tool inspired by Anchor modeler, for PostgreSQL

This is a tool I wrote a while ago for some fancy (bi-)temporal DB modelling with PostgreSQL. Inspired by Anchormodeler, which was MS SQL -only at the time of writing.

NB. This is an exploratory project in DB modelling, not for production use, etc. etc.

Principles:

  • Aim for a maximally normalized data model (i.e., 6NF)
  • Use DB constraints to the fullest extent feasible

Features:

  • Temporal 6NF database support with a notion of "validity time" AND transaction time
  • Support for individual localized fields
  • Uses PostgreSQL specific features to the fullest extent: domains, table inheritance, extensions, etc.
  • Doesn't get in the way (hopefully): When something is easier to define in SQL directly, allows doing that
  • Temporal and non-temporal enums (with optionally localized values). Although PostgreSQL also has Enum types, we don't use them here since they have more overhead (4 bytes) and it's easier to work with integers directly when working with other languages.

Missing:

  • A mechanism for all types of schema updates. Outright conflicts with previous schema versions make it difficult to
  • Composite primary key support in some cases

Usage:

  1. Define a schema in a YAML file (no examples provided as of now)
  2. Create a PostgreSQL database with the btree_gist extension, ensuring it is UTF-8.
  3. Execute modeler for any relevant output modes (e.g. sql, flask): python modeler.py sql < model.yaml > db.sql python modeler.py flask < model.yaml > flask_model.py

Inner workings

  • Generated SQL can be executed without side-effects multiple times (i.e., the generated SQL is idempotent)
  • Possible schema incompatibilities (relatively rare) must be resolved with another mechanism.
  • GIST indexes are used to enforce temporal consistency

modeler's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

refset

modeler's Issues

Please add an example file

This looks very interesting! It’d be great if you could add an example yaml file tho so it’s easier to try an example run.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.