Created
January 7, 2017 21:06
-
-
Save iuridiniz/eb74196c07503fb6294bc568a1e5afe2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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