Skip to content

Instantly share code, notes, and snippets.

@iuridiniz
Created January 7, 2017 21:06
Show Gist options
  • Save iuridiniz/eb74196c07503fb6294bc568a1e5afe2 to your computer and use it in GitHub Desktop.
Save iuridiniz/eb74196c07503fb6294bc568a1e5afe2 to your computer and use it in GitHub Desktop.
from __future__ import print_function
from sqlalchemy import create_engine, Column, types
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.orm import Session
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship, backref
engine = create_engine('sqlite:///:memory:', echo=True)
Base = declarative_base()
session = scoped_session(sessionmaker(bind=engine))
class User(Base):
__tablename__ = "users"
id = Column(types.Integer, primary_key=True)
nullable_true = Column(types.String(255), nullable=True)
nullable_false = Column(types.String(255), nullable=False)
nullable_default = Column(types.String(255))
Base.metadata.create_all(engine)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment