Skip to content

Instantly share code, notes, and snippets.

View djrobstep's full-sized avatar

Robert Lechte djrobstep

View GitHub Profile
@djrobstep
djrobstep / orm.py
Last active January 28, 2022 17:32
orm.py: An ORM for the ORM haters
import inspect
import pprint
import textwrap
from collections.abc import Iterable
from dataclasses import asdict
from dataclasses import field as dataclass_field
from dataclasses import fields as dataclass_fields
from dataclasses import make_dataclass
import results
@djrobstep
djrobstep / sqlalchemy_dynamic_table_creation.py
Created May 18, 2016 14:28
SQLAlchemy ORM code to create SQL tables from a dynamically defined column list
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from sqlalchemy import Column, MetaData, Table, create_engine
from sqlalchemy import String, Integer, Float, BigInteger, DateTime
from sqlalchemy.schema import DropTable, CreateTable
from sqlalchemy.orm import scoped_session, sessionmaker