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
import sqlalchemy as sa | |
import sqlalchemy.orm as orm | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.ext.declarative import declared_attr | |
from sqlalchemy.orm import scoped_session, sessionmaker | |
DBSession = scoped_session(sessionmaker()) | |
class BaseMixin(object): | |
query = DBSession.query_property() | |
id = sa.Column(sa.Integer, primary_key=True) |
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
""" | |
A demo of creating a new database via SQL Alchemy. | |
Under MIT License from sprin (https://gist.github.com/sprin/5846464/) | |
This module takes the form of a nosetest with three steps: | |
- Set up the new database. | |
- Create a table in the new database. | |
- Teardown the new database. | |
""" |
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
def fetch_import_statement(): | |
my_imports = """ | |
import ast | |
import dill as pickle | |
import re | |
import pymongo | |
from datetime import datetime | |
import proton.blueprint |