ORM Data Management

By pjain      Published May 5, 2020, 5:18 a.m. in blog Programming   


Dart, Flutter ORM


  • It is a Source-generated ORM
  • Homepage https://jaguar-dart.github.io
  • Jaguar_orm
  • Features relationships (one-to-one, one-to-many, many-to-many) Preloads Cascading: Cascaded inserts, Cascaded updates, Cascaded removals Migration Polymorphic relations Composite primary keys Composite foreign keys


Lite - can be model for our goMDK DBI

Aqueduct is a modern Dart HTTP server framework and libraries used to build scalable REST APIs that run on the Dart VM. - Handling and routing HTTP requests - Object-relational mapping (ORM) - Authentication and authorization (OAuth 2.0 provider) - API documentation (OpenAPI)

ORM Commonalities and Arch Review

Connections Management and Config

Environments, Config

  • Note different setups will be there for develop, test, stage and production


    # from Orator an ActiveRecord style Python ORM

    class User(Model):
        __table__ = 'user'  # class name lower case as  default if not defined, field names meta-picked from class members

    users = User.all()
    u1 = User.find(1)  // by id
    us = User.where('votes', '>', 100).take(10).get()
    for u1 in us:

    c = User.where('votes', '>', 100).count()  // aggregate
    us = User.where_raw('age > ? and votes = 100',[25]).get() 

Perf factors

  • Streaming or Chunking Results
  • If you need to process a lot of records, you can use the chunk method to avoid consuming a lot of RAM:

    for users in User.chunk(100): for user in users: # ...

How is an ORM useful?

When you build an application or service that uses a relational database, there is a point when you can't just get away with just using parameterized queries or even query builder, you just keep repeating yourself, writing slightly different code for each entity. Code has no idea about relations between data, so you end up concatenating your data almost manually. It is also easy to make a mistake in how you access your database, making it easy for SQL-injection attacks to occur. Your data rules are also distributed, increasing the complexity of managing your data, and even worse, is applied inconsistently.

An ORM (Object Relational Mapper) is designed to address these issues, by centralizing your data model and data rules, ensuring that your data is managed safely (providing immunity to SQL-injection) and keeps track of relationships so you don't have to.

Data Modelling, Query Tools

  • prisma.io - Modern DB toolkit to query, migrate and model your database - for TS, Node.js
  • Prisma.io

Top ORMs

Python Lite or Full Stack

Tortoise for Asyncio Python

Peewee Python3+ AsyncIO - can be model for our DBI

  • Lite - can be model for our goMDK DBI
  • Python3+ PG-using aiopg, MySQL via aiomysql
  • https://github.com/05bit/peewee-async
  • Peewee Async desc
  • docs

Pony ORM


Django and Full Stack Python

ORM/Caching Support within Django

  • Doesn't Django optimize with Caching?

  • Django ORM cache with automatic granular event-driven invalidation. It uses redis as backend for ORM cache and redis or filesystem for simple time-invalidated one. Decorators to cache any user function or view as a queryset or by time Extensions for django and jinja2 templates Transparent transaction support Dog-pile prevention mechanism A couple of hacks to make django faster

  • Django Cacheops

Using Django as backend ORM

Java Lite DBI/ORM

  • ormlite Setup your classes by simply adding Java annotations. Powerful abstract Database Access Object (DAO) classes. Flexible query builder to easily construct simple and complex queries. Supports MySQL, Postgres, Microsoft SQL Server, H2, Derby, HSQLDB, and Sqlite and can be extended to additional databases relatively easily. Provisional support for DB2, Oracle, ODBC, and Netezza. Contact the author if your database type is not supported. Handles "compiled" SQL statements for repetitive query tasks. Supports "foreign" objects with the class field being the object but an id stored in the database table. Basic support for database transactions. Auto generates SQL to create and drop database tables. Spring configuration support for DOAs and class configurations. Support for configuring of tables and fields without annotations. Supports native calls to Android SQLite database APIs.
  • Homepage
  • https://github.com/j256/ormlite-core
  • Pure Java needs ormlite-jdbc
  • Ormlite Core - provides a lite Java ORM in conjunction with ormlite-jdbc or ormlite-android

Simple Low Star Rated


Kotlin DBI

  • Exposed as SQL-DSL or DAO.
  • It offers two levels of database access: typesafe SQL wrapping DSL and lightweight data access objects. Exposed can mimic a variety of database engines and help you build database applications without hard dependencies on any specific database engine, and switch between them with very little or no changes in your code.
  • It supports multiple DBMS - H2, MySQL, MariaDB, Oracle, PG, PG-JDBC driver, SQL Server, SQLite
  • Exposed

  • X Belleorm - CRUD

  • Belleorm Sqlite ORM library for Kotlin, Java & Android.

Mobile Cross Platform -

  • Realm

  • Room - ? android only?

IOS, Swift ORMs

Other Languages


There are no comments yet

Add new comment

Similar posts

Markov Models Quickstart

Monte Carlo Models, Chains and Monte Carlo Simulation

Collaboration, Sync Processing =========