Python sqlalchemy.dialects.postgresql.BYTEA Examples
The following are 12
code examples of sqlalchemy.dialects.postgresql.BYTEA().
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.dialects.postgresql
, or try the search function
.
Example #1
Source File: d4841aeeb072_.py From gitlab-tools with GNU General Public License v3.0 | 6 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('task_result', sa.Column('traceback', sa.TEXT(), autoincrement=False, nullable=True)) op.add_column('task_result', sa.Column('task_id', sa.VARCHAR(length=155), autoincrement=False, nullable=True)) op.add_column('task_result', sa.Column('date_done', postgresql.TIMESTAMP(), autoincrement=False, nullable=True)) op.add_column('task_result', sa.Column('status', sa.VARCHAR(length=50), autoincrement=False, nullable=True)) op.add_column('task_result', sa.Column('result', postgresql.BYTEA(), autoincrement=False, nullable=True)) op.drop_constraint(None, 'task_result', type_='foreignkey') op.create_unique_constraint('task_result_task_id_key', 'task_result', ['task_id']) op.drop_index(op.f('ix_task_result_celery_taskmeta_id'), table_name='task_result') op.drop_column('task_result', 'celery_taskmeta_id') op.drop_table('celery_tasksetmeta') op.drop_table('celery_taskmeta') # ### end Alembic commands ###
Example #2
Source File: test_postgresql.py From alembic with MIT License | 6 votes |
def test_postgresql_hstore_subtypes(self): eq_ignore_whitespace( autogenerate.render._repr_type(HSTORE(), self.autogen_context), "postgresql.HSTORE(text_type=sa.Text())", ) eq_ignore_whitespace( autogenerate.render._repr_type( HSTORE(text_type=String()), self.autogen_context ), "postgresql.HSTORE(text_type=sa.String())", ) eq_ignore_whitespace( autogenerate.render._repr_type( HSTORE(text_type=BYTEA()), self.autogen_context ), "postgresql.HSTORE(text_type=postgresql.BYTEA())", ) assert ( "from sqlalchemy.dialects import postgresql" in self.autogen_context.imports )
Example #3
Source File: test_postgresql.py From alembic with MIT License | 5 votes |
def test_postgresql_array_type(self): eq_ignore_whitespace( autogenerate.render._repr_type( ARRAY(Integer), self.autogen_context ), "postgresql.ARRAY(sa.Integer())", ) eq_ignore_whitespace( autogenerate.render._repr_type( ARRAY(DateTime(timezone=True)), self.autogen_context ), "postgresql.ARRAY(sa.DateTime(timezone=True))", ) eq_ignore_whitespace( autogenerate.render._repr_type( ARRAY(BYTEA, as_tuple=True, dimensions=2), self.autogen_context ), "postgresql.ARRAY(postgresql.BYTEA(), " "as_tuple=True, dimensions=2)", ) assert ( "from sqlalchemy.dialects import postgresql" in self.autogen_context.imports )
Example #4
Source File: test_postgresql.py From alembic with MIT License | 5 votes |
def test_generic_array_type(self): eq_ignore_whitespace( autogenerate.render._repr_type( types.ARRAY(Integer), self.autogen_context ), "sa.ARRAY(sa.Integer())", ) eq_ignore_whitespace( autogenerate.render._repr_type( types.ARRAY(DateTime(timezone=True)), self.autogen_context ), "sa.ARRAY(sa.DateTime(timezone=True))", ) assert ( "from sqlalchemy.dialects import postgresql" not in self.autogen_context.imports ) eq_ignore_whitespace( autogenerate.render._repr_type( types.ARRAY(BYTEA, as_tuple=True, dimensions=2), self.autogen_context, ), "sa.ARRAY(postgresql.BYTEA(), as_tuple=True, dimensions=2)", ) assert ( "from sqlalchemy.dialects import postgresql" in self.autogen_context.imports )
Example #5
Source File: 20190302_15-02-04__remove_simplekv_store.py From busy-beaver with MIT License | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('kv_store', sa.Column('key', sa.VARCHAR(length=250), autoincrement=False, nullable=False), sa.Column('value', postgresql.BYTEA(), autoincrement=False, nullable=False), sa.PrimaryKeyConstraint('key', name='kv_store_pkey') ) # ### end Alembic commands ###
Example #6
Source File: 2d3b166fe612_make_sha1_columns_nullable.py From wiki-scripts with GNU General Public License v3.0 | 5 votes |
def upgrade(): op.alter_column('archive', 'ar_sha1', existing_type=postgresql.BYTEA(), nullable=True, server_default=None, existing_server_default=sa.text("'\\x'::bytea")) op.alter_column('revision', 'rev_sha1', existing_type=postgresql.BYTEA(), nullable=True, server_default=None, existing_server_default=sa.text("'\\x'::bytea")) # create ad-hoc tables for data migration archive = sa.sql.table("archive", sa.Column("ar_sha1", postgresql.BYTEA()) # other columns not needed for the data migration ) revision = sa.sql.table("revision", sa.Column("rev_sha1", postgresql.BYTEA()) # other columns not needed for the data migration ) # migrate empty data to NULL op.execute( archive.update().where(archive.c.ar_sha1 == b"").values({"ar_sha1": None}) ) op.execute( revision.update().where(revision.c.rev_sha1 == b"").values({"rev_sha1": None}) )
Example #7
Source File: 2d3b166fe612_make_sha1_columns_nullable.py From wiki-scripts with GNU General Public License v3.0 | 5 votes |
def downgrade(): # create ad-hoc tables for data migration archive = sa.sql.table("archive", sa.Column("ar_sha1", postgresql.BYTEA()) # other columns not needed for the data migration ) revision = sa.sql.table("revision", sa.Column("rev_sha1", postgresql.BYTEA()) # other columns not needed for the data migration ) # migrate NULL values to empty data op.execute( archive.update().where(archive.c.ar_sha1 == None).values({"ar_sha1": b""}) ) op.execute( revision.update().where(revision.c.rev_sha1 == None).values({"rev_sha1": b""}) ) op.alter_column('revision', 'rev_sha1', existing_type=postgresql.BYTEA(), nullable=False, server_default=sa.text("'\\x'::bytea"), existing_server_default=None) op.alter_column('archive', 'ar_sha1', existing_type=postgresql.BYTEA(), nullable=False, server_default=sa.text("'\\x'::bytea"), existing_server_default=None)
Example #8
Source File: 6cb6a6a151b7_removed_unused_page_tables_and_fields.py From pygameweb with BSD 2-Clause "Simplified" License | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('node', sa.Column('modules_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.add_column('node', sa.Column('skin_id', sa.INTEGER(), autoincrement=False, nullable=True)) op.add_column('node', sa.Column('type', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) op.add_column('node', sa.Column('target', sa.VARCHAR(length=80), autoincrement=False, nullable=True)) op.add_column('node', sa.Column('custom', postgresql.BYTEA(), autoincrement=False, nullable=True)) op.add_column('node', sa.Column('folder', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True)) op.add_column('node', sa.Column('image', sa.VARCHAR(length=255), autoincrement=False, nullable=True)) op.add_column('node', sa.Column('folderid', sa.INTEGER(), autoincrement=False, nullable=True)) op.add_column('node', sa.Column('parentid', sa.INTEGER(), autoincrement=False, nullable=True)) op.add_column('node', sa.Column('mods', sa.INTEGER(), autoincrement=False, nullable=True)) op.rename_table('page', 'node') op.execute('ALTER SEQUENCE page_id_seq RENAME TO node_id_seq') op.create_table('modules', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('title', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('orders', sa.INTEGER(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='modules_pkey') ) op.create_table('skin', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('title', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('fname', sa.VARCHAR(length=80), autoincrement=False, nullable=True), sa.Column('orders', sa.INTEGER(), autoincrement=False, nullable=True), sa.PrimaryKeyConstraint('id', name='skin_pkey') ) # ### end Alembic commands ###
Example #9
Source File: 4b27843a188a_v12_final.py From QCFractal with BSD 3-Clause "New" or "Revised" License | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column( "collection", "group", existing_type=sa.VARCHAR(), type_=sa.String(length=100), existing_nullable=False ) op.alter_column("molecule", "geometry", existing_type=postgresql.BYTEA(), nullable=False) op.alter_column("molecule", "symbols", existing_type=postgresql.BYTEA(), nullable=False) op.alter_column("task_queue", "spec", existing_type=postgresql.BYTEA(), nullable=False) op.drop_constraint("task_queue_manager_fkey", "task_queue", type_="foreignkey") op.create_foreign_key( "task_queue_manager_fkey", "task_queue", "queue_manager", ["manager"], ["name"], ondelete="SET NULL" ) # ### end Alembic commands ###
Example #10
Source File: 4b27843a188a_v12_final.py From QCFractal with BSD 3-Clause "New" or "Revised" License | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint("task_queue_manager_fkey", "task_queue", type_="foreignkey") op.create_foreign_key("task_queue_manager_fkey", "task_queue", "queue_manager", ["manager"], ["name"]) op.alter_column("task_queue", "spec", existing_type=postgresql.BYTEA(), nullable=True) op.alter_column("molecule", "symbols", existing_type=postgresql.BYTEA(), nullable=True) op.alter_column("molecule", "geometry", existing_type=postgresql.BYTEA(), nullable=True) op.alter_column( "collection", "group", existing_type=sa.String(length=100), type_=sa.VARCHAR(), existing_nullable=False ) # ### end Alembic commands ###
Example #11
Source File: 20190624_02-33-30__make_slack_installation_cols_non_.py From busy-beaver with MIT License | 4 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column( "slack_installation", "access_token", existing_type=postgresql.BYTEA(), nullable=False, ) op.alter_column( "slack_installation", "authorizing_user_id", existing_type=sa.VARCHAR(length=300), nullable=False, ) op.alter_column( "slack_installation", "bot_access_token", existing_type=postgresql.BYTEA(), nullable=False, ) op.alter_column( "slack_installation", "bot_user_id", existing_type=postgresql.BYTEA(), nullable=False, ) op.alter_column( "slack_installation", "scope", existing_type=sa.VARCHAR(length=300), nullable=False, ) op.alter_column( "slack_installation", "workspace_id", existing_type=sa.VARCHAR(length=20), nullable=False, ) op.alter_column( "slack_installation", "workspace_name", existing_type=sa.VARCHAR(length=255), nullable=False, ) # ### end Alembic commands ###
Example #12
Source File: 20190624_02-33-30__make_slack_installation_cols_non_.py From busy-beaver with MIT License | 4 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column( "slack_installation", "workspace_name", existing_type=sa.VARCHAR(length=255), nullable=True, ) op.alter_column( "slack_installation", "workspace_id", existing_type=sa.VARCHAR(length=20), nullable=True, ) op.alter_column( "slack_installation", "scope", existing_type=sa.VARCHAR(length=300), nullable=True, ) op.alter_column( "slack_installation", "bot_user_id", existing_type=postgresql.BYTEA(), nullable=True, ) op.alter_column( "slack_installation", "bot_access_token", existing_type=postgresql.BYTEA(), nullable=True, ) op.alter_column( "slack_installation", "authorizing_user_id", existing_type=sa.VARCHAR(length=300), nullable=True, ) op.alter_column( "slack_installation", "access_token", existing_type=postgresql.BYTEA(), nullable=True, ) # ### end Alembic commands ###