Python sqlalchemy.BigInteger() Examples
The following are 30
code examples of sqlalchemy.BigInteger().
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
, or try the search function
.
Example #1
Source File: test_autogen_diffs.py From alembic with MIT License | 6 votes |
def test_alter_column_autoincrement_compositepk_explicit_true(self): m1 = MetaData() m2 = MetaData() Table( "a", m1, Column("id", Integer, primary_key=True, autoincrement=False), Column("x", Integer, primary_key=True, autoincrement=True), # on SQLA 1.0 and earlier, this being present # trips the "add KEY for the primary key" so that the # AUTO_INCREMENT keyword is accepted by MySQL. SQLA 1.1 and # greater the columns are just reorganized. mysql_engine="InnoDB", ) Table( "a", m2, Column("id", Integer, primary_key=True, autoincrement=False), Column("x", BigInteger, primary_key=True, autoincrement=True), ) ops = self._fixture(m1, m2, return_ops=True) is_(ops.ops[0].ops[0].kw["autoincrement"], True)
Example #2
Source File: test_autogen_diffs.py From alembic with MIT License | 6 votes |
def test_alter_column_autoincrement_pk_false(self): m1 = MetaData() m2 = MetaData() Table( "a", m1, Column("x", Integer, primary_key=True, autoincrement=False), ) Table( "a", m2, Column("x", BigInteger, primary_key=True, autoincrement=False), ) ops = self._fixture(m1, m2, return_ops=True) is_(ops.ops[0].ops[0].kw["autoincrement"], False)
Example #3
Source File: 575767d9f89_added_source_history_table.py From rucio with Apache License 2.0 | 6 votes |
def upgrade(): ''' Upgrade the database to this revision ''' if context.get_context().dialect.name in ['oracle', 'mysql', 'postgresql']: create_table('sources_history', sa.Column('request_id', GUID()), sa.Column('scope', sa.String(25)), sa.Column('name', sa.String(255)), sa.Column('rse_id', GUID()), sa.Column('dest_rse_id', GUID()), sa.Column('url', sa.String(2048)), sa.Column('bytes', sa.BigInteger), sa.Column('ranking', sa.Integer()), sa.Column('is_using', sa.Boolean(), default=False)) schema = context.get_context().version_table_schema if context.get_context().version_table_schema else '' add_column('requests', sa.Column('estimated_at', sa.DateTime), schema=schema) add_column('requests_history', sa.Column('estimated_at', sa.DateTime), schema=schema)
Example #4
Source File: 379a19b5332d_create_rse_limits_table.py From rucio with Apache License 2.0 | 6 votes |
def upgrade(): ''' Upgrade the database to this revision ''' if context.get_context().dialect.name in ['oracle', 'mysql', 'postgresql']: create_table('rse_transfer_limits', sa.Column('rse_id', GUID()), sa.Column('activity', sa.String(50)), sa.Column('rse_expression', sa.String(3000)), sa.Column('max_transfers', sa.BigInteger), sa.Column('transfers', sa.BigInteger), sa.Column('waitings', sa.BigInteger), sa.Column('created_at', sa.DateTime, default=datetime.datetime.utcnow), sa.Column('updated_at', sa.DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow)) create_primary_key('RSE_TRANSFER_LIMITS_PK', 'rse_transfer_limits', ['rse_id', 'activity']) create_check_constraint('RSE_TRANSFER_LIMITS_CREATED_NN', 'rse_transfer_limits', 'created_at is not null') create_check_constraint('RSE_TRANSFER_LIMITS_UPDATED_NN', 'rse_transfer_limits', 'updated_at is not null') create_foreign_key('RSE_TRANSFER_LIMITS_RSE_ID_FK', 'rse_transfer_limits', 'rses', ['rse_id'], ['id'])
Example #5
Source File: test_autogen_diffs.py From alembic with MIT License | 6 votes |
def test_alter_column_autoincrement_nonpk_false(self): m1 = MetaData() m2 = MetaData() Table( "a", m1, Column("id", Integer, primary_key=True), Column("x", Integer, autoincrement=False), ) Table( "a", m2, Column("id", Integer, primary_key=True), Column("x", BigInteger, autoincrement=False), ) ops = self._fixture(m1, m2, return_ops=True) is_(ops.ops[0].ops[0].kw["autoincrement"], False)
Example #6
Source File: test_autogen_diffs.py From alembic with MIT License | 6 votes |
def test_alter_column_autoincrement_nonpk_implicit_false(self): m1 = MetaData() m2 = MetaData() Table( "a", m1, Column("id", Integer, primary_key=True), Column("x", Integer), ) Table( "a", m2, Column("id", Integer, primary_key=True), Column("x", BigInteger), ) ops = self._fixture(m1, m2, return_ops=True) assert "autoincrement" not in ops.ops[0].ops[0].kw
Example #7
Source File: test_autogen_diffs.py From alembic with MIT License | 6 votes |
def test_alter_column_autoincrement_nonpk_explicit_true(self): m1 = MetaData() m2 = MetaData() Table( "a", m1, Column("id", Integer, primary_key=True), Column("x", Integer, autoincrement=True), ) Table( "a", m2, Column("id", Integer, primary_key=True), Column("x", BigInteger, autoincrement=True), ) ops = self._fixture(m1, m2, return_ops=True) is_(ops.ops[0].ops[0].kw["autoincrement"], True)
Example #8
Source File: a74275a1ad30_added_global_quota_table.py From rucio with Apache License 2.0 | 6 votes |
def upgrade(): ''' Upgrade the database to this revision ''' if context.get_context().dialect.name in ['oracle', 'mysql', 'postgresql']: create_table(table_name, sa.Column('rse_expression', sa.String(3000)), sa.Column('bytes', sa.BigInteger()), sa.Column('account', sa.String(25)), sa.Column('created_at', sa.DateTime, default=datetime.datetime.utcnow), sa.Column('updated_at', sa.DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow)) create_primary_key('ACCOUNT_GLOB_LIMITS_PK', table_name, ['account', 'rse_expression']) create_check_constraint('ACCOUNT_GLOB_LIMITS_CREATED_NN', table_name, 'created_at is not null') create_check_constraint('ACCOUNT_GLOB_LIMITS_UPDATED_NN', table_name, 'updated_at is not null') create_foreign_key('ACCOUNT_GLOBAL_LIMITS_ACC_FK', table_name, 'accounts', ['account'], ['account'])
Example #9
Source File: 3ad36e2268b0_create_collection_replicas_updates_table.py From rucio with Apache License 2.0 | 6 votes |
def upgrade(): ''' Upgrade the database to this revision ''' if context.get_context().dialect.name in ['oracle', 'mysql', 'postgresql']: schema = context.get_context().version_table_schema if context.get_context().version_table_schema else '' add_column('collection_replicas', sa.Column('available_replicas_cnt', sa.BigInteger()), schema=schema) add_column('collection_replicas', sa.Column('available_bytes', sa.BigInteger()), schema=schema) create_table('updated_col_rep', sa.Column('id', GUID()), sa.Column('scope', sa.String(25)), sa.Column('name', sa.String(255)), sa.Column('did_type', DIDType.db_type()), sa.Column('rse_id', GUID()), sa.Column('created_at', sa.DateTime, default=datetime.datetime.utcnow), sa.Column('updated_at', sa.DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow)) create_primary_key('UPDATED_COL_REP_PK', 'updated_col_rep', ['id']) create_check_constraint('UPDATED_COL_REP_SCOPE_NN', 'updated_col_rep', 'scope IS NOT NULL') create_check_constraint('UPDATED_COL_REP_NAME_NN', 'updated_col_rep', 'name IS NOT NULL') create_index('UPDATED_COL_REP_SNR_IDX', 'updated_col_rep', ['scope', 'name', 'rse_id'])
Example #10
Source File: test_autogen_diffs.py From alembic with MIT License | 6 votes |
def test_alter_column_autoincrement_compositepk_false(self): m1 = MetaData() m2 = MetaData() Table( "a", m1, Column("id", Integer, primary_key=True), Column("x", Integer, primary_key=True, autoincrement=False), ) Table( "a", m2, Column("id", Integer, primary_key=True), Column("x", BigInteger, primary_key=True, autoincrement=False), ) ops = self._fixture(m1, m2, return_ops=True) is_(ops.ops[0].ops[0].kw["autoincrement"], False)
Example #11
Source File: 3d560427d776_add_sequence_number_to_journal.py From networking-odl with Apache License 2.0 | 6 votes |
def upgrade(): op.create_table( 'opendaylightjournal_new', sa.Column('seqnum', sa.BigInteger(), primary_key=True, autoincrement=True), sa.Column('object_type', sa.String(36), nullable=False), sa.Column('object_uuid', sa.String(36), nullable=False), sa.Column('operation', sa.String(36), nullable=False), sa.Column('data', sa.PickleType, nullable=True), sa.Column('state', sa.Enum('pending', 'processing', 'failed', 'completed', name='state'), nullable=False, default='pending'), sa.Column('retry_count', sa.Integer, default=0), sa.Column('created_at', sa.DateTime, default=sa.func.now()), sa.Column('last_retried', sa.TIMESTAMP, server_default=sa.func.now(), onupdate=sa.func.now()), )
Example #12
Source File: 0084_add_job_stats.py From notifications-api with MIT License | 6 votes |
def upgrade(): op.create_table('job_statistics', sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('job_id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('emails_sent', sa.BigInteger(), nullable=False), sa.Column('emails_delivered', sa.BigInteger(), nullable=False), sa.Column('emails_failed', sa.BigInteger(), nullable=False), sa.Column('sms_sent', sa.BigInteger(), nullable=False), sa.Column('sms_delivered', sa.BigInteger(), nullable=False), sa.Column('sms_failed', sa.BigInteger(), nullable=False), sa.Column('letters_sent', sa.BigInteger(), nullable=False), sa.Column('letters_failed', sa.BigInteger(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_job_statistics_job_id'), 'job_statistics', ['job_id'], unique=True)
Example #13
Source File: test_codegen.py From safrs with GNU General Public License v3.0 | 6 votes |
def test_column_adaptation(metadata): Table("simple_items", metadata, Column("id", postgresql.BIGINT), Column("length", postgresql.DOUBLE_PRECISION)) assert ( generate_code(metadata) == """\ # coding: utf-8 from sqlalchemy import BigInteger, Column, Float, MetaData, Table metadata = MetaData() t_simple_items = Table( 'simple_items', metadata, Column('id', BigInteger), Column('length', Float) ) """ )
Example #14
Source File: 00042_49308bd51717_kvstore_table.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 6 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('key_value_store', sa.Column('id', sa.BigInteger(), nullable=False), sa.Column('key', sa.Text(), nullable=False), sa.Column('value', postgresql.JSONB(astext_type=sa.Text()), nullable=True), sa.PrimaryKeyConstraint('id') ) print("Creating index") op.create_index(op.f('ix_key_value_store_key'), 'key_value_store', ['key'], unique=True) print("Applying not-null constraing") op.alter_column('nu_release_item', 'release_date', existing_type=postgresql.TIMESTAMP(), nullable=False) # ### end Alembic commands ###
Example #15
Source File: 0005_add_provider_stats.py From notifications-api with MIT License | 6 votes |
def upgrade(): op.create_table('provider_rates', sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('valid_from', sa.DateTime(), nullable=False), sa.Column('provider', sa.Enum('mmg', 'twilio', 'firetext', 'ses', name='providers'), nullable=False), sa.Column('rate', sa.Numeric(), nullable=False), sa.PrimaryKeyConstraint('id') ) op.create_table('provider_statistics', sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('day', sa.Date(), nullable=False), sa.Column('provider', sa.Enum('mmg', 'twilio', 'firetext', 'ses', name='providers'), nullable=False), sa.Column('service_id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('unit_count', sa.BigInteger(), nullable=False), sa.ForeignKeyConstraint(['service_id'], ['services.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_provider_statistics_service_id'), 'provider_statistics', ['service_id'], unique=False)
Example #16
Source File: 00027_c92e0c8632d7_more_rss_stuff.py From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License | 6 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('rss_parser_feed_name_lut', sa.Column('feed_id', sa.BigInteger(), nullable=False)) op.create_index(op.f('ix_rss_parser_feed_name_lut_feed_id'), 'rss_parser_feed_name_lut', ['feed_id'], unique=False) op.drop_index('ix_rss_parser_feed_name_lut_feed_name', table_name='rss_parser_feed_name_lut') op.drop_constraint('rss_parser_feed_name_lut_feed_netloc_feed_name_key', 'rss_parser_feed_name_lut', type_='unique') op.create_unique_constraint(None, 'rss_parser_feed_name_lut', ['feed_netloc', 'feed_id']) op.drop_constraint('rss_parser_feed_name_lut_feed_name_fkey', 'rss_parser_feed_name_lut', type_='foreignkey') op.create_foreign_key(None, 'rss_parser_feed_name_lut', 'rss_parser_funcs', ['feed_id'], ['id']) op.drop_column('rss_parser_feed_name_lut', 'feed_name') op.add_column('rss_parser_feed_name_lut_version', sa.Column('feed_id', sa.BigInteger(), autoincrement=False, nullable=True)) op.create_index(op.f('ix_rss_parser_feed_name_lut_version_feed_id'), 'rss_parser_feed_name_lut_version', ['feed_id'], unique=False) op.drop_index('ix_rss_parser_feed_name_lut_version_feed_name', table_name='rss_parser_feed_name_lut_version') op.drop_column('rss_parser_feed_name_lut_version', 'feed_name') op.alter_column('rss_parser_funcs', 'func', existing_type=sa.TEXT(), nullable=True) ### end Alembic commands ###
Example #17
Source File: dagcode.py From airflow with Apache License 2.0 | 5 votes |
def dag_fileloc_hash(full_filepath: str) -> int: """Hashing file location for indexing. :param full_filepath: full filepath of DAG file :return: hashed full_filepath """ # Hashing is needed because the length of fileloc is 2000 as an Airflow convention, # which is over the limit of indexing. import hashlib # Only 7 bytes because MySQL BigInteger can hold only 8 bytes (signed). return struct.unpack('>Q', hashlib.sha1( full_filepath.encode('utf-8')).digest()[-8:])[0] >> 8
Example #18
Source File: 0003_add_service_history.py From notifications-api with MIT License | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('services_history', sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.Column('active', sa.Boolean(), nullable=False), sa.Column('message_limit', sa.BigInteger(), nullable=False), sa.Column('restricted', sa.Boolean(), nullable=False), sa.Column('email_from', sa.Text(), nullable=False), sa.Column('created_by_id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('version', sa.Integer(), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('id', 'version') ) op.create_index(op.f('ix_services_history_created_by_id'), 'services_history', ['created_by_id'], unique=False) op.add_column('services', sa.Column('created_by_id', postgresql.UUID(as_uuid=True), nullable=True)) op.add_column('services', sa.Column('version', sa.Integer(), nullable=True)) op.create_index(op.f('ix_services_created_by_id'), 'services', ['created_by_id'], unique=False) op.create_foreign_key('fk_services_created_by_id', 'services', 'users', ['created_by_id'], ['id']) op.get_bind() op.execute('UPDATE services SET created_by_id = (SELECT user_id FROM user_to_service WHERE services.id = user_to_service.service_id LIMIT 1)') op.execute('UPDATE services SET version = 1') op.execute('INSERT INTO services_history SELECT * FROM services') op.alter_column('services', 'created_by_id', nullable=False) op.alter_column('services', 'version', nullable=False) ### end Alembic commands ###
Example #19
Source File: 8d7d772eafcf_add_standard_attribute_id_for_l2gw.py From networking-l2gw with Apache License 2.0 | 5 votes |
def upgrade(): for table in TABLES: op.add_column(table, sa.Column('standard_attr_id', sa.BigInteger(), nullable=True))
Example #20
Source File: 0124_add_free_sms_fragment_limit.py From notifications-api with MIT License | 5 votes |
def upgrade(): op.add_column('services_history', sa.Column('free_sms_fragment_limit', sa.BigInteger(), nullable=True)) op.add_column('services', sa.Column('free_sms_fragment_limit', sa.BigInteger(), nullable=True))
Example #21
Source File: 952da73b5eff_add_dag_code_table.py From airflow with Apache License 2.0 | 5 votes |
def upgrade(): """Create DagCode Table.""" from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class SerializedDagModel(Base): __tablename__ = 'serialized_dag' # There are other columns here, but these are the only ones we need for the SELECT/UPDATE we are doing dag_id = sa.Column(sa.String(250), primary_key=True) fileloc = sa.Column(sa.String(2000), nullable=False) fileloc_hash = sa.Column(sa.BigInteger, nullable=False) """Apply add source code table""" op.create_table('dag_code', # pylint: disable=no-member sa.Column('fileloc_hash', sa.BigInteger(), nullable=False, primary_key=True, autoincrement=False), sa.Column('fileloc', sa.String(length=2000), nullable=False), sa.Column('source_code', sa.UnicodeText(), nullable=False), sa.Column('last_updated', sa.TIMESTAMP(timezone=True), nullable=False)) conn = op.get_bind() if conn.dialect.name not in ('sqlite'): if conn.dialect.name == "mssql": op.drop_index('idx_fileloc_hash', 'serialized_dag') op.alter_column(table_name='serialized_dag', column_name='fileloc_hash', type_=sa.BigInteger(), nullable=False) if conn.dialect.name == "mssql": op.create_index('idx_fileloc_hash', 'serialized_dag', ['fileloc_hash']) sessionmaker = sa.orm.sessionmaker() session = sessionmaker(bind=conn) serialized_dags = session.query(SerializedDagModel).all() for dag in serialized_dags: dag.fileloc_hash = DagCode.dag_fileloc_hash(dag.fileloc) session.merge(dag) session.commit()
Example #22
Source File: b1d4118a005b_.py From SempoBlockchain with GNU General Public License v3.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('blockchain_wallet', sa.Column('wei_topup_target', sa.BigInteger(), nullable=True)) op.drop_column('blockchain_wallet', 'wei_topup_amount') # ### end Alembic commands ###
Example #23
Source File: a589fdb5724c_change_size_of_as_number.py From neutron-dynamic-routing with Apache License 2.0 | 5 votes |
def upgrade(): op.alter_column('bgp_speakers', 'local_as', nullable=False, type_=sa.BigInteger()) op.alter_column('bgp_peers', 'remote_as', nullable=False, type_=sa.BigInteger())
Example #24
Source File: sql.py From vnpy_crypto with MIT License | 5 votes |
def _is_sqlalchemy_connectable(con): global _SQLALCHEMY_INSTALLED if _SQLALCHEMY_INSTALLED is None: try: import sqlalchemy _SQLALCHEMY_INSTALLED = True from distutils.version import LooseVersion ver = sqlalchemy.__version__ # For sqlalchemy versions < 0.8.2, the BIGINT type is recognized # for a sqlite engine, which results in a warning when trying to # read/write a DataFrame with int64 values. (GH7433) if LooseVersion(ver) < LooseVersion('0.8.2'): from sqlalchemy import BigInteger from sqlalchemy.ext.compiler import compiles @compiles(BigInteger, 'sqlite') def compile_big_int_sqlite(type_, compiler, **kw): return 'INTEGER' except ImportError: _SQLALCHEMY_INSTALLED = False if _SQLALCHEMY_INSTALLED: import sqlalchemy return isinstance(con, sqlalchemy.engine.Connectable) else: return False
Example #25
Source File: c11292016060_add_request_errors_for_stats.py From octavia with Apache License 2.0 | 5 votes |
def upgrade(): op.add_column('listener_statistics', sa.Column('request_errors', sa.BigInteger(), nullable=False, default=0))
Example #26
Source File: 007a183ddcf9_.py From SempoBlockchain with GNU General Public License v3.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('blockchain_wallet', sa.Column('wei_target_balance', sa.BigInteger(), nullable=True)) op.drop_column('blockchain_wallet', 'wei_topup_target') # ### end Alembic commands ###
Example #27
Source File: 9e96b52b50d8_.py From SempoBlockchain with GNU General Public License v3.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('blockchain_address', 'address', existing_type=sa.VARCHAR(), nullable=True) op.add_column('blockchain_task', sa.Column('gasLimit', sa.BigInteger(), nullable=True)) # ### end Alembic commands ###
Example #28
Source File: 5d327a0b562f_.py From SempoBlockchain with GNU General Public License v3.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('blockchain_task', sa.Column('gas_limit', sa.BigInteger(), nullable=True)) op.drop_column('blockchain_task', 'gasLimit') # ### end Alembic commands ###
Example #29
Source File: 606591437586_.py From SempoBlockchain with GNU General Public License v3.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('blockchain_address', sa.Column('wei_topup_amount', sa.BigInteger(), nullable=True)) op.add_column('blockchain_address', sa.Column('wei_topup_threshold', sa.BigInteger(), nullable=True)) op.add_column('blockchain_task', sa.Column('signing_wallet_id', sa.Integer(), nullable=True)) op.drop_constraint('blockchain_task_signing_address_id_fkey', 'blockchain_task', type_='foreignkey') op.create_foreign_key(None, 'blockchain_task', 'blockchain_address', ['signing_wallet_id'], ['id']) op.drop_column('blockchain_task', 'signing_address_id') op.add_column('blockchain_transaction', sa.Column('signing_wallet_id', sa.Integer(), nullable=True)) op.drop_constraint('blockchain_transaction_signing_address_id_fkey', 'blockchain_transaction', type_='foreignkey') op.create_foreign_key(None, 'blockchain_transaction', 'blockchain_address', ['signing_wallet_id'], ['id']) op.drop_column('blockchain_transaction', 'signing_address_id') # ### end Alembic commands ###
Example #30
Source File: abf824df9ae6_.py From SempoBlockchain with GNU General Public License v3.0 | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_column('user', 'foo') op.alter_column('transfer_account', 'balance', existing_type=sa.BigInteger(), type_=sa.Integer()) # ### end Alembic commands ###