Python sqlalchemy.types.SMALLINT Examples
The following are 3
code examples of sqlalchemy.types.SMALLINT().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sqlalchemy.types
, or try the search function
.
Example #1
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 5 votes |
def test_boolean_detection(metadata): Table( "simple_items", metadata, Column("bool1", INTEGER), Column("bool2", SMALLINT), Column("bool3", mysql.TINYINT), CheckConstraint("simple_items.bool1 IN (0, 1)"), CheckConstraint("simple_items.bool2 IN (0, 1)"), CheckConstraint("simple_items.bool3 IN (0, 1)"), ) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import Boolean, Column, MetaData, Table metadata = MetaData() t_simple_items = Table( 'simple_items', metadata, Column('bool1', Boolean), Column('bool2', Boolean), Column('bool3', Boolean) ) """ )
Example #2
Source File: schema.py From hivemind with MIT License | 5 votes |
def build_metadata_blacklist(metadata=None): if not metadata: metadata = sa.MetaData() sa.Table( 'hive_posts_status', metadata, sa.Column('id', sa.Integer, primary_key=True, autoincrement=True), sa.Column('post_id', sa.Integer, nullable=False, server_default='0'), sa.Column('author', VARCHAR(16), nullable=False, server_default=''), sa.Column('list_type', SMALLINT, nullable=False, server_default='0'), sa.Column('created_at', sa.DateTime, nullable=False, server_default='1990-01-01'), sa.UniqueConstraint('list_type', 'post_id', 'author', name='hive_posts_status_ux1'), ) return metadata
Example #3
Source File: __init__.py From parade with MIT License | 5 votes |
def sqltype_to_stdtype(sqltype): import sqlalchemy.types as sqltypes if isinstance(sqltype, (sqltypes.VARCHAR, sqltypes.CHAR, sqltypes.TEXT, sqltypes.Enum, sqltypes.String)): return _STRING_TYPE if isinstance(sqltype, (sqltypes.DATETIME, sqltypes.DATE, sqltypes.TIME, sqltypes.TIMESTAMP)): return _DATE_TYPE if isinstance(sqltype, (sqltypes.INTEGER, sqltypes.BIGINT, sqltypes.SMALLINT, sqltypes.Integer)): return _INTEGER_TYPE if isinstance(sqltype, (sqltypes.REAL, sqltypes.DECIMAL, sqltypes.NUMERIC, sqltypes.FLOAT)): return _DECIMAL_TYPE if isinstance(sqltype, sqltypes.BOOLEAN): return _BOOLEAN_TYPE