This file contains 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 sqlalchemy.orm.query import Query | |
from sqlalchemy.sql import ClauseElement | |
from sqlalchemy import cast, Boolean | |
class PublicQuery(Query): | |
''' | |
Filters all queries by publicity condition for each participating mapped | |
class. Attribute "public" of mapped class (if present) should be either |
This file contains 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
# -*- coding: utf-8 -*- | |
from sqlalchemy import create_engine | |
from sqlalchemy.types import SchemaType | |
from sqlalchemy.engine import reflection | |
from sqlalchemy.schema import ( | |
MetaData, | |
Table, | |
DropTable, | |
ForeignKeyConstraint, |
This file contains 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 itertools import izip | |
def chunkify(iterable, chunk_size): | |
r""" | |
>>> chunkify(range(1, 11), 2) | |
[(1, 2), (3, 4), (5, 6), (7, 8), (9, 10)] | |
""" | |
_iterable = iter(iterable) | |
return izip(*[_iterable] * chunk_size) |