当前位置: 首页>>代码示例>>Python>>正文


Python sqlalchemy.TEXT属性代码示例

本文整理汇总了Python中sqlalchemy.TEXT属性的典型用法代码示例。如果您正苦于以下问题:Python sqlalchemy.TEXT属性的具体用法?Python sqlalchemy.TEXT怎么用?Python sqlalchemy.TEXT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在sqlalchemy的用法示例。


在下文中一共展示了sqlalchemy.TEXT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _transaction_test

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:27,代码来源:test_sql.py

示例2: test_execute_fail

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:20,代码来源:test_sql.py

示例3: test_execute_closed_connection

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:20,代码来源:test_sql.py

示例4: downgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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 ### 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:22,代码来源:00007_cb674b790e4a_more_nu_stuff.py

示例5: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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 ### 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:20,代码来源:00027_c92e0c8632d7_more_rss_stuff.py

示例6: downgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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 ### 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:22,代码来源:00030_be0687950ece_actually_dropping_unused_columns_now.py

示例7: _transaction_test

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:27,代码来源:test_sql.py

示例8: test_execute_closed_connection

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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) 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:23,代码来源:test_sql.py

示例9: test_execute_closed_connection

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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) 
开发者ID:securityclippy,项目名称:elasticintel,代码行数:23,代码来源:test_sql.py

示例10: downgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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 ### 
开发者ID:TitanEmbeds,项目名称:Titan,代码行数:18,代码来源:1d2c2dc41e86_removed_guild_members_table.py

示例11: downgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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 ### 
开发者ID:TitanEmbeds,项目名称:Titan,代码行数:18,代码来源:52271b243ba2_remove_messages_table_for_good.py

示例12: downgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('departments', sa.Column('what_this_is', sa.TEXT(), autoincrement=False, nullable=True))
    ### end Alembic commands ### 
开发者ID:codeforamerica,项目名称:comport,代码行数:6,代码来源:529cc76baaa_.py

示例13: downgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('departments', sa.Column('why_we_are_doing_this', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('departments', sa.Column('contact_us', sa.TEXT(), autoincrement=False, nullable=True))
    op.add_column('departments', sa.Column('how_you_can_use_this_data', sa.TEXT(), autoincrement=False, nullable=True))
    ### end Alembic commands ### 
开发者ID:codeforamerica,项目名称:comport,代码行数:8,代码来源:a6192071a8_.py

示例14: downgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('chart_block_defaults',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('title', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
    sa.Column('caption', sa.VARCHAR(length=255), autoincrement=False, nullable=True),
    sa.Column('slug', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
    sa.Column('dataset', sa.VARCHAR(length=255), autoincrement=False, nullable=False),
    sa.Column('content', sa.TEXT(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('id', name='chart_block_defaults_pkey')
    )
    ### end Alembic commands ### 
开发者ID:codeforamerica,项目名称:comport,代码行数:14,代码来源:4e4710949dd_.py

示例15: downgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import TEXT [as 别名]
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 ### 
开发者ID:Salamek,项目名称:gitlab-tools,代码行数:16,代码来源:d4841aeeb072_.py


注:本文中的sqlalchemy.TEXT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。