Python sqlalchemy.TEXT Examples

The following are 30 code examples of sqlalchemy.TEXT(). 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_sql.py    From elasticintel with GNU General Public License v3.0 6 votes vote down vote up
def test_execute_fail(self):
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a, b)
        );
        """
        cur = self.conn.cursor()
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        sql.execute('INSERT INTO test VALUES("foo", "baz", 2.567)', self.conn)

        with pytest.raises(Exception):
            sql.execute('INSERT INTO test VALUES("foo", "bar", 7)', self.conn) 
Example #2
Source File: d4841aeeb072_.py    From gitlab-tools with GNU General Public License v3.0 6 votes vote down vote up
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 #3
Source File: 52271b243ba2_remove_messages_table_for_good.py    From Titan with GNU Affero General Public License v3.0 6 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('messages',
    sa.Column('guild_id', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('channel_id', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('message_id', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('content', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('author', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=False),
    sa.Column('edited_timestamp', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('mentions', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('attachments', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('embeds', sa.TEXT(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('message_id', name='messages_pkey')
    )
    # ### end Alembic commands ### 
Example #4
Source File: 1d2c2dc41e86_removed_guild_members_table.py    From Titan with GNU Affero General Public License v3.0 6 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('guild_members',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('guild_id', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('user_id', sa.BIGINT(), autoincrement=False, nullable=False),
    sa.Column('username', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
    sa.Column('discriminator', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('nickname', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
    sa.Column('avatar', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
    sa.Column('active', sa.BOOLEAN(), server_default=sa.text('true'), autoincrement=False, nullable=False),
    sa.Column('banned', sa.BOOLEAN(), server_default=sa.text('false'), autoincrement=False, nullable=False),
    sa.Column('roles', sa.TEXT(), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('id', name='idx_25210_primary')
    )
    # ### end Alembic commands ### 
Example #5
Source File: test_sql.py    From recruit with Apache License 2.0 6 votes vote down vote up
def test_execute_fail(self):
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a, b)
        );
        """
        cur = self.conn.cursor()
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        sql.execute('INSERT INTO test VALUES("foo", "baz", 2.567)', self.conn)

        with pytest.raises(Exception):
            sql.execute('INSERT INTO test VALUES("foo", "bar", 7)', self.conn) 
Example #6
Source File: test_sql.py    From recruit with Apache License 2.0 6 votes vote down vote up
def test_execute_closed_connection(self):
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a, b)
        );
        """
        cur = self.conn.cursor()
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        self.conn.close()

        with pytest.raises(Exception):
            tquery("select * from test", con=self.conn) 
Example #7
Source File: test_sql.py    From recruit with Apache License 2.0 6 votes vote down vote up
def _transaction_test(self):
        self.pandasSQL.execute("CREATE TABLE test_trans (A INT, B TEXT)")

        ins_sql = "INSERT INTO test_trans (A,B) VALUES (1, 'blah')"

        # Make sure when transaction is rolled back, no rows get inserted
        try:
            with self.pandasSQL.run_transaction() as trans:
                trans.execute(ins_sql)
                raise Exception('error')
        except Exception:
            # ignore raised exception
            pass
        res = self.pandasSQL.read_query('SELECT * FROM test_trans')
        assert len(res) == 0

        # Make sure when transaction is committed, rows do get inserted
        with self.pandasSQL.run_transaction() as trans:
            trans.execute(ins_sql)
        res2 = self.pandasSQL.read_query('SELECT * FROM test_trans')
        assert len(res2) == 1


# -----------------------------------------------------------------------------
# -- Testing the public API 
Example #8
Source File: test_sql.py    From elasticintel with GNU General Public License v3.0 6 votes vote down vote up
def test_execute_closed_connection(self):
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a, b)
        );
        """
        cur = self.conn.cursor()
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        self.conn.close()

        with pytest.raises(Exception):
            tquery("select * from test", con=self.conn)

        # Initialize connection again (needed for tearDown)
        self.setup_method(self.method) 
Example #9
Source File: test_sql.py    From recruit with Apache License 2.0 6 votes vote down vote up
def test_execute_closed_connection(self, request, datapath):
        drop_sql = "DROP TABLE IF EXISTS test"
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a(5), b(5))
        );
        """
        cur = self.conn.cursor()
        cur.execute(drop_sql)
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        self.conn.close()

        with pytest.raises(Exception):
            tquery("select * from test", con=self.conn)

        # Initialize connection again (needed for tearDown)
        self.setup_method(request, datapath) 
Example #10
Source File: test_sql.py    From elasticintel with GNU General Public License v3.0 6 votes vote down vote up
def test_execute_closed_connection(self):
        _skip_if_no_pymysql()
        drop_sql = "DROP TABLE IF EXISTS test"
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a(5), b(5))
        );
        """
        cur = self.conn.cursor()
        cur.execute(drop_sql)
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        self.conn.close()

        with pytest.raises(Exception):
            tquery("select * from test", con=self.conn)

        # Initialize connection again (needed for tearDown)
        self.setup_method(self.method) 
Example #11
Source File: test_sql.py    From twitter-stock-recommendation with MIT License 6 votes vote down vote up
def _transaction_test(self):
        self.pandasSQL.execute("CREATE TABLE test_trans (A INT, B TEXT)")

        ins_sql = "INSERT INTO test_trans (A,B) VALUES (1, 'blah')"

        # Make sure when transaction is rolled back, no rows get inserted
        try:
            with self.pandasSQL.run_transaction() as trans:
                trans.execute(ins_sql)
                raise Exception('error')
        except:
            # ignore raised exception
            pass
        res = self.pandasSQL.read_query('SELECT * FROM test_trans')
        assert len(res) == 0

        # Make sure when transaction is committed, rows do get inserted
        with self.pandasSQL.run_transaction() as trans:
            trans.execute(ins_sql)
        res2 = self.pandasSQL.read_query('SELECT * FROM test_trans')
        assert len(res2) == 1


# -----------------------------------------------------------------------------
# -- Testing the public API 
Example #12
Source File: test_sql.py    From elasticintel with GNU General Public License v3.0 6 votes vote down vote up
def _transaction_test(self):
        self.pandasSQL.execute("CREATE TABLE test_trans (A INT, B TEXT)")

        ins_sql = "INSERT INTO test_trans (A,B) VALUES (1, 'blah')"

        # Make sure when transaction is rolled back, no rows get inserted
        try:
            with self.pandasSQL.run_transaction() as trans:
                trans.execute(ins_sql)
                raise Exception('error')
        except:
            # ignore raised exception
            pass
        res = self.pandasSQL.read_query('SELECT * FROM test_trans')
        assert len(res) == 0

        # Make sure when transaction is committed, rows do get inserted
        with self.pandasSQL.run_transaction() as trans:
            trans.execute(ins_sql)
        res2 = self.pandasSQL.read_query('SELECT * FROM test_trans')
        assert len(res2) == 1


# -----------------------------------------------------------------------------
# -- Testing the public API 
Example #13
Source File: 00007_cb674b790e4a_more_nu_stuff.py    From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('nu_outbound_wrappers', sa.Column('target_url', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('nu_outbound_wrappers', sa.Column('link_url', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('nu_outbound_wrappers', sa.Column('container_page', sa.TEXT(), autoincrement=False, nullable=True))
    op.create_index('ix_nu_outbound_wrappers_link_url', 'nu_outbound_wrappers', ['link_url'], unique=False)
    op.create_index('ix_nu_outbound_wrappers_container_page', 'nu_outbound_wrappers', ['container_page'], unique=False)
    op.drop_index(op.f('ix_nu_outbound_wrappers_seriesname'), table_name='nu_outbound_wrappers')
    op.drop_index(op.f('ix_nu_outbound_wrappers_groupinfo'), table_name='nu_outbound_wrappers')
    op.drop_index(op.f('ix_nu_outbound_wrappers_client_key'), table_name='nu_outbound_wrappers')
    op.drop_index(op.f('ix_nu_outbound_wrappers_client_id'), table_name='nu_outbound_wrappers')
    op.drop_column('nu_outbound_wrappers', 'seriesname')
    op.drop_column('nu_outbound_wrappers', 'releaseinfo')
    op.drop_column('nu_outbound_wrappers', 'referrer')
    op.drop_column('nu_outbound_wrappers', 'outbound_wrapper')
    op.drop_column('nu_outbound_wrappers', 'groupinfo')
    op.drop_column('nu_outbound_wrappers', 'client_key')
    op.drop_column('nu_outbound_wrappers', 'client_id')
    op.drop_column('nu_outbound_wrappers', 'actual_target')
    ### end Alembic commands ### 
Example #14
Source File: 00027_c92e0c8632d7_more_rss_stuff.py    From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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 #15
Source File: 00030_be0687950ece_actually_dropping_unused_columns_now.py    From ReadableWebProxy with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('feed_pages', sa.Column('feedurl', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('feed_pages', sa.Column('srcname', sa.TEXT(), autoincrement=False, nullable=True))
    op.create_table('nu_outbound_wrappers',
    sa.Column('id', sa.BIGINT(), nullable=False),
    sa.Column('actual_target', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('client_id', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('client_key', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('groupinfo', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('outbound_wrapper', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('referrer', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('releaseinfo', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('seriesname', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('validated', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.Column('released_on', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='nu_outbound_wrappers_pkey'),
    sa.UniqueConstraint('client_id', 'client_key', 'seriesname', 'releaseinfo', 'groupinfo', 'actual_target', name='nu_outbound_wrappers_client_id_client_key_seriesname_releas_key')
    )
    ### end Alembic commands ### 
Example #16
Source File: test_sql.py    From vnpy_crypto with MIT License 6 votes vote down vote up
def _transaction_test(self):
        self.pandasSQL.execute("CREATE TABLE test_trans (A INT, B TEXT)")

        ins_sql = "INSERT INTO test_trans (A,B) VALUES (1, 'blah')"

        # Make sure when transaction is rolled back, no rows get inserted
        try:
            with self.pandasSQL.run_transaction() as trans:
                trans.execute(ins_sql)
                raise Exception('error')
        except:
            # ignore raised exception
            pass
        res = self.pandasSQL.read_query('SELECT * FROM test_trans')
        assert len(res) == 0

        # Make sure when transaction is committed, rows do get inserted
        with self.pandasSQL.run_transaction() as trans:
            trans.execute(ins_sql)
        res2 = self.pandasSQL.read_query('SELECT * FROM test_trans')
        assert len(res2) == 1


# -----------------------------------------------------------------------------
# -- Testing the public API 
Example #17
Source File: test_sql.py    From vnpy_crypto with MIT License 6 votes vote down vote up
def test_execute_fail(self):
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a, b)
        );
        """
        cur = self.conn.cursor()
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        sql.execute('INSERT INTO test VALUES("foo", "baz", 2.567)', self.conn)

        with pytest.raises(Exception):
            sql.execute('INSERT INTO test VALUES("foo", "bar", 7)', self.conn) 
Example #18
Source File: test_sql.py    From vnpy_crypto with MIT License 6 votes vote down vote up
def test_execute_closed_connection(self, request, datapath):
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a, b)
        );
        """
        cur = self.conn.cursor()
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        self.conn.close()

        with pytest.raises(Exception):
            tquery("select * from test", con=self.conn)

        # Initialize connection again (needed for tearDown)
        self.setup_method(request, datapath) 
Example #19
Source File: test_sql.py    From vnpy_crypto with MIT License 6 votes vote down vote up
def test_execute_closed_connection(self, request, datapath):
        _skip_if_no_pymysql()
        drop_sql = "DROP TABLE IF EXISTS test"
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a(5), b(5))
        );
        """
        cur = self.conn.cursor()
        cur.execute(drop_sql)
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        self.conn.close()

        with pytest.raises(Exception):
            tquery("select * from test", con=self.conn)

        # Initialize connection again (needed for tearDown)
        self.setup_method(request, datapath) 
Example #20
Source File: test_sql.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 6 votes vote down vote up
def _transaction_test(self):
        self.pandasSQL.execute("CREATE TABLE test_trans (A INT, B TEXT)")

        ins_sql = "INSERT INTO test_trans (A,B) VALUES (1, 'blah')"

        # Make sure when transaction is rolled back, no rows get inserted
        try:
            with self.pandasSQL.run_transaction() as trans:
                trans.execute(ins_sql)
                raise Exception('error')
        except Exception:
            # ignore raised exception
            pass
        res = self.pandasSQL.read_query('SELECT * FROM test_trans')
        assert len(res) == 0

        # Make sure when transaction is committed, rows do get inserted
        with self.pandasSQL.run_transaction() as trans:
            trans.execute(ins_sql)
        res2 = self.pandasSQL.read_query('SELECT * FROM test_trans')
        assert len(res2) == 1


# -----------------------------------------------------------------------------
# -- Testing the public API 
Example #21
Source File: test_sql.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 6 votes vote down vote up
def test_execute_fail(self):
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a, b)
        );
        """
        cur = self.conn.cursor()
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        sql.execute('INSERT INTO test VALUES("foo", "baz", 2.567)', self.conn)

        with pytest.raises(Exception):
            sql.execute('INSERT INTO test VALUES("foo", "bar", 7)', self.conn) 
Example #22
Source File: test_sql.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 6 votes vote down vote up
def test_execute_closed_connection(self):
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a, b)
        );
        """
        cur = self.conn.cursor()
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        self.conn.close()

        with pytest.raises(Exception):
            tquery("select * from test", con=self.conn) 
Example #23
Source File: test_sql.py    From predictive-maintenance-using-machine-learning with Apache License 2.0 6 votes vote down vote up
def test_execute_closed_connection(self, request, datapath):
        drop_sql = "DROP TABLE IF EXISTS test"
        create_sql = """
        CREATE TABLE test
        (
        a TEXT,
        b TEXT,
        c REAL,
        PRIMARY KEY (a(5), b(5))
        );
        """
        cur = self.conn.cursor()
        cur.execute(drop_sql)
        cur.execute(create_sql)

        sql.execute('INSERT INTO test VALUES("foo", "bar", 1.234)', self.conn)
        self.conn.close()

        with pytest.raises(Exception):
            tquery("select * from test", con=self.conn)

        # Initialize connection again (needed for tearDown)
        self.setup_method(request, datapath) 
Example #24
Source File: 5824cd5ed16d_remove_rc_ip.py    From wiki-scripts with GNU General Public License v3.0 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('recentchanges', sa.Column('rc_ip', sa.TEXT(), autoincrement=False, nullable=True))
    op.create_index('rc_ip', 'recentchanges', ['rc_ip'], unique=False)
    # ### end Alembic commands ### 
Example #25
Source File: b1ca8054f845_remove_category_table.py    From wiki-scripts with GNU General Public License v3.0 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('category',
    sa.Column('cat_id', sa.INTEGER(), autoincrement=True, nullable=False),
    sa.Column('cat_title', sa.TEXT(), autoincrement=False, nullable=False),
    sa.Column('cat_pages', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False),
    sa.Column('cat_subcats', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False),
    sa.Column('cat_files', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('cat_id', name='category_pkey')
    )
    op.create_index('cat_title', 'category', ['cat_title'], unique=True)
    op.create_index('cat_pages', 'category', ['cat_pages'], unique=False)
    # ### end Alembic commands ### 
Example #26
Source File: 36_3f2bc9bc2775_.py    From betterlifepsi with MIT License 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('preference',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('def_so_incoming_type_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('def_so_incoming_status_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('def_so_exp_type_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('def_so_exp_status_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('def_po_logistic_exp_status_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('def_po_logistic_exp_type_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('def_po_goods_exp_status_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('def_po_goods_exp_type_id', sa.INTEGER(), autoincrement=False, nullable=False),
    sa.Column('remark', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('organization_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['def_po_goods_exp_status_id'], [u'enum_values.id'], name=u'preference_def_po_goods_exp_status_id_fkey'),
    sa.ForeignKeyConstraint(['def_po_goods_exp_type_id'], [u'enum_values.id'], name=u'preference_def_po_goods_exp_type_id_fkey'),
    sa.ForeignKeyConstraint(['def_po_logistic_exp_status_id'], [u'enum_values.id'], name=u'preference_def_po_logistic_exp_status_id_fkey'),
    sa.ForeignKeyConstraint(['def_po_logistic_exp_type_id'], [u'enum_values.id'], name=u'preference_def_po_logistic_exp_type_id_fkey'),
    sa.ForeignKeyConstraint(['def_so_exp_status_id'], [u'enum_values.id'], name=u'preference_def_so_exp_status_id_fkey'),
    sa.ForeignKeyConstraint(['def_so_exp_type_id'], [u'enum_values.id'], name=u'preference_def_so_exp_type_id_fkey'),
    sa.ForeignKeyConstraint(['def_so_incoming_status_id'], [u'enum_values.id'], name=u'preference_def_so_incoming_status_id_fkey'),
    sa.ForeignKeyConstraint(['def_so_incoming_type_id'], [u'enum_values.id'], name=u'preference_def_so_incoming_type_id_fkey'),
    sa.ForeignKeyConstraint(['organization_id'], [u'organization.id'], name=u'preference_organization_id_fkey'),
    sa.PrimaryKeyConstraint('id', name=u'preference_pkey')
    )
    # ### end Alembic commands ### 
Example #27
Source File: dccf36ae49e4_alter_db.py    From travelcrm with GNU General Public License v3.0 5 votes vote down vote up
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('mail', 'html_content',
               existing_type=sa.TEXT(),
               nullable=True)
    ### end Alembic commands ### 
Example #28
Source File: dccf36ae49e4_alter_db.py    From travelcrm with GNU General Public License v3.0 5 votes vote down vote up
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('mail', 'html_content',
               existing_type=sa.TEXT(),
               nullable=False)
    ### end Alembic commands ### 
Example #29
Source File: cd04a8335c18_mgmt_url_to_mgmt_ip_address.py    From tacker with Apache License 2.0 5 votes vote down vote up
def upgrade(active_plugins=None, options=None):
    op.alter_column('ns',
        'mgmt_urls', new_column_name='mgmt_ip_addresses',
        existing_type=sa.TEXT(65535), nullable=True)
    op.alter_column('vnf',
        'mgmt_url', new_column_name='mgmt_ip_address',
        existing_type=sa.String(255), nullable=True) 
Example #30
Source File: d9b134d71b1f_alter_db.py    From travelcrm with GNU General Public License v3.0 5 votes vote down vote up
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('mail', 'subject')
    op.add_column('campaign', sa.Column('plain_content', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('campaign', sa.Column('subject', sa.VARCHAR(length=128), autoincrement=False, nullable=False))
    op.add_column('campaign', sa.Column('html_content', sa.TEXT(), autoincrement=False, nullable=True))
    op.drop_constraint('fk_mail_id_campaign', 'campaign', type_='foreignkey')
    op.drop_constraint('fk_person_category_id_campaign', 'campaign', type_='foreignkey')
    op.drop_column('campaign', 'person_category_id')
    op.drop_column('campaign', 'mail_id')
    ### end Alembic commands ###