Python sqlalchemy.UnicodeText() Examples
The following are 30
code examples of sqlalchemy.UnicodeText().
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: 157debc89661_adding_category_and_population_groups.py From radremedy with Mozilla Public License 2.0 | 6 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('category_group', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.Unicode(length=100), nullable=False), sa.Column('description', sa.UnicodeText(), nullable=True), sa.Column('grouporder', sa.Float(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.create_table('population_group', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.Unicode(length=100), nullable=False), sa.Column('description', sa.UnicodeText(), nullable=True), sa.Column('grouporder', sa.Float(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) op.add_column(u'category', sa.Column('grouping_id', sa.Integer(), nullable=True)) op.add_column(u'population', sa.Column('grouping_id', sa.Integer(), nullable=True)) ### end Alembic commands ###
Example #2
Source File: test_types.py From sqlalchemy with MIT License | 6 votes |
def test_charset_collate_table(self): t = Table( "foo", self.metadata, Column("id", Integer), Column("data", UnicodeText), mysql_default_charset="utf8", mysql_collate="utf8_bin", ) t.create() m2 = MetaData(testing.db) t2 = Table("foo", m2, autoload=True) eq_(t2.kwargs["mysql_collate"], "utf8_bin") eq_(t2.kwargs["mysql_default charset"], "utf8") # test [ticket:2906] # in order to test the condition here, need to use # MySQLdb 1.2.3 and also need to pass either use_unicode=1 # or charset=utf8 to the URL. t.insert().execute(id=1, data=u("some text")) assert isinstance( testing.db.scalar(select([t.c.data])), util.text_type )
Example #3
Source File: test_types.py From sqlalchemy with MIT License | 6 votes |
def test_large_type_deprecation(self): d1 = mssql.dialect(deprecate_large_types=True) d2 = mssql.dialect(deprecate_large_types=False) d3 = mssql.dialect() d3.server_version_info = (11, 0) d3._setup_version_attributes() d4 = mssql.dialect() d4.server_version_info = (10, 0) d4._setup_version_attributes() for dialect in (d1, d3): eq_(str(Text().compile(dialect=dialect)), "VARCHAR(max)") eq_(str(UnicodeText().compile(dialect=dialect)), "NVARCHAR(max)") eq_(str(LargeBinary().compile(dialect=dialect)), "VARBINARY(max)") for dialect in (d2, d4): eq_(str(Text().compile(dialect=dialect)), "TEXT") eq_(str(UnicodeText().compile(dialect=dialect)), "NTEXT") eq_(str(LargeBinary().compile(dialect=dialect)), "IMAGE")
Example #4
Source File: db.py From ckanext-xloader with GNU Affero General Public License v3.0 | 6 votes |
def _init_jobs_table(): """Initialise the "jobs" table in the db.""" _jobs_table = sqlalchemy.Table( 'jobs', _METADATA, sqlalchemy.Column('job_id', sqlalchemy.UnicodeText, primary_key=True), sqlalchemy.Column('job_type', sqlalchemy.UnicodeText), sqlalchemy.Column('status', sqlalchemy.UnicodeText, index=True), sqlalchemy.Column('data', sqlalchemy.UnicodeText), sqlalchemy.Column('error', sqlalchemy.UnicodeText), sqlalchemy.Column('requested_timestamp', sqlalchemy.DateTime), sqlalchemy.Column('finished_timestamp', sqlalchemy.DateTime), sqlalchemy.Column('sent_data', sqlalchemy.UnicodeText), # Callback URL: sqlalchemy.Column('result_url', sqlalchemy.UnicodeText), # CKAN API key: sqlalchemy.Column('api_key', sqlalchemy.UnicodeText), ) return _jobs_table
Example #5
Source File: test_dialect.py From sqlalchemy with MIT License | 6 votes |
def test_ora8_flags(self): dialect = self._dialect((8, 2, 5)) # before connect, assume modern DB assert dialect._supports_char_length assert dialect.use_ansi assert not dialect._use_nchar_for_unicode dialect.initialize(Mock()) assert not dialect.implicit_returning assert not dialect._supports_char_length assert not dialect.use_ansi self.assert_compile(String(50), "VARCHAR2(50)", dialect=dialect) self.assert_compile(Unicode(50), "VARCHAR2(50)", dialect=dialect) self.assert_compile(UnicodeText(), "CLOB", dialect=dialect) dialect = self._dialect((8, 2, 5), implicit_returning=True) dialect.initialize(testing.db.connect()) assert dialect.implicit_returning
Example #6
Source File: 0cd36ecdd937_.py From 0x0 with ISC License | 6 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('URL', sa.Column('id', sa.Integer(), nullable=False), sa.Column('url', sa.UnicodeText(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('url') ) op.create_table('file', sa.Column('id', sa.Integer(), nullable=False), sa.Column('sha256', sa.String(), nullable=True), sa.Column('ext', sa.UnicodeText(), nullable=True), sa.Column('mime', sa.UnicodeText(), nullable=True), sa.Column('addr', sa.UnicodeText(), nullable=True), sa.Column('removed', sa.Boolean(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('sha256') ) ### end Alembic commands ###
Example #7
Source File: test_dialect.py From sqlalchemy with MIT License | 5 votes |
def test_default_flags(self): """test with no initialization or server version info""" dialect = self._dialect(None) assert dialect._supports_char_length assert not dialect._use_nchar_for_unicode assert dialect.use_ansi self.assert_compile(String(50), "VARCHAR2(50 CHAR)", dialect=dialect) self.assert_compile(Unicode(50), "VARCHAR2(50 CHAR)", dialect=dialect) self.assert_compile(UnicodeText(), "CLOB", dialect=dialect)
Example #8
Source File: 34ee9496b788_replace_varchar_with_text.py From wiki-scripts with GNU General Public License v3.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('interwiki', 'iw_prefix', existing_type=sa.VARCHAR(length=32), type_=sa.UnicodeText()) op.alter_column('namespace_canonical', 'nsc_name', existing_type=sa.VARCHAR(length=32), type_=sa.UnicodeText(), existing_nullable=False) op.alter_column('namespace_name', 'nsn_name', existing_type=sa.VARCHAR(length=32), type_=sa.UnicodeText(), existing_nullable=False) op.alter_column('namespace_starname', 'nss_name', existing_type=sa.VARCHAR(length=32), type_=sa.UnicodeText(), existing_nullable=False) op.alter_column('tag', 'tag_displayname', existing_type=sa.VARCHAR(length=255), type_=sa.UnicodeText(), existing_nullable=False) op.alter_column('tag', 'tag_name', existing_type=sa.VARCHAR(length=255), type_=sa.UnicodeText(), existing_nullable=False) op.alter_column('ws_sync', 'wss_key', existing_type=sa.VARCHAR(length=32), type_=sa.UnicodeText()) # ### end Alembic commands ###
Example #9
Source File: 34ee9496b788_replace_varchar_with_text.py From wiki-scripts with GNU General Public License v3.0 | 5 votes |
def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('ws_sync', 'wss_key', existing_type=sa.UnicodeText(), type_=sa.VARCHAR(length=32)) op.alter_column('tag', 'tag_name', existing_type=sa.UnicodeText(), type_=sa.VARCHAR(length=255), existing_nullable=False) op.alter_column('tag', 'tag_displayname', existing_type=sa.UnicodeText(), type_=sa.VARCHAR(length=255), existing_nullable=False) op.alter_column('namespace_starname', 'nss_name', existing_type=sa.UnicodeText(), type_=sa.VARCHAR(length=32), existing_nullable=False) op.alter_column('namespace_name', 'nsn_name', existing_type=sa.UnicodeText(), type_=sa.VARCHAR(length=32), existing_nullable=False) op.alter_column('namespace_canonical', 'nsc_name', existing_type=sa.UnicodeText(), type_=sa.VARCHAR(length=32), existing_nullable=False) op.alter_column('interwiki', 'iw_prefix', existing_type=sa.UnicodeText(), type_=sa.VARCHAR(length=32)) # ### end Alembic commands ###
Example #10
Source File: c4c0733acb37_create_section_table.py From wiki-scripts with GNU General Public License v3.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('section', sa.Column('sec_page', sa.Integer(), nullable=False), sa.Column('sec_number', sa.Integer(), nullable=False), sa.Column('sec_level', sa.Integer(), nullable=False), sa.Column('sec_title', sa.UnicodeText(), nullable=False), sa.Column('sec_anchor', sa.UnicodeText(), nullable=False), sa.CheckConstraint('sec_level >= 1 and sec_level <= 6', name='check_sec_level'), sa.CheckConstraint('sec_number > 0', name='check_sec_number'), sa.ForeignKeyConstraint(['sec_page'], ['page.page_id'], ondelete='CASCADE', initially='DEFERRED', deferrable=True), sa.PrimaryKeyConstraint('sec_page', 'sec_number') ) op.create_index('sec_page_anchor', 'section', ['sec_page', 'sec_anchor'], unique=True) # ### end Alembic commands ###
Example #11
Source File: db.py From ckanext-xloader with GNU Affero General Public License v3.0 | 5 votes |
def _init_metadata_table(): """Initialise the "metadata" table in the db.""" _metadata_table = sqlalchemy.Table( 'metadata', _METADATA, sqlalchemy.Column( 'job_id', sqlalchemy.ForeignKey("jobs.job_id", ondelete="CASCADE"), nullable=False, primary_key=True), sqlalchemy.Column('key', sqlalchemy.UnicodeText, primary_key=True), sqlalchemy.Column('value', sqlalchemy.UnicodeText, index=True), sqlalchemy.Column('type', sqlalchemy.UnicodeText), ) return _metadata_table
Example #12
Source File: db.py From ckanext-xloader with GNU Affero General Public License v3.0 | 5 votes |
def _init_logs_table(): """Initialise the "logs" table in the db.""" _logs_table = sqlalchemy.Table( 'logs', _METADATA, sqlalchemy.Column( 'job_id', sqlalchemy.ForeignKey("jobs.job_id", ondelete="CASCADE"), nullable=False), sqlalchemy.Column('timestamp', sqlalchemy.DateTime), sqlalchemy.Column('message', sqlalchemy.UnicodeText), sqlalchemy.Column('level', sqlalchemy.UnicodeText), sqlalchemy.Column('module', sqlalchemy.UnicodeText), sqlalchemy.Column('funcName', sqlalchemy.UnicodeText), sqlalchemy.Column('lineno', sqlalchemy.Integer) ) return _logs_table
Example #13
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 #14
Source File: test_dialect.py From sqlalchemy with MIT License | 5 votes |
def test_ora10_flags(self): dialect = self._dialect((10, 2, 5)) dialect.initialize(Mock()) assert dialect._supports_char_length assert not dialect._use_nchar_for_unicode assert dialect.use_ansi self.assert_compile(String(50), "VARCHAR2(50 CHAR)", dialect=dialect) self.assert_compile(Unicode(50), "VARCHAR2(50 CHAR)", dialect=dialect) self.assert_compile(UnicodeText(), "CLOB", dialect=dialect)
Example #15
Source File: test_dialect.py From sqlalchemy with MIT License | 5 votes |
def test_use_nchar(self): dialect = self._dialect((10, 2, 5), use_nchar_for_unicode=True) dialect.initialize(Mock()) assert dialect._use_nchar_for_unicode self.assert_compile(String(50), "VARCHAR2(50 CHAR)", dialect=dialect) self.assert_compile(Unicode(50), "NVARCHAR2(50)", dialect=dialect) self.assert_compile(UnicodeText(), "NCLOB", dialect=dialect)
Example #16
Source File: test_reflection.py From sqlalchemy with MIT License | 5 votes |
def test_string_types(self): specs = [ (String(1), mysql.MSString(1)), (String(3), mysql.MSString(3)), (Text(), mysql.MSText()), (Unicode(1), mysql.MSString(1)), (Unicode(3), mysql.MSString(3)), (UnicodeText(), mysql.MSText()), (mysql.MSChar(1), mysql.MSChar(1)), (mysql.MSChar(3), mysql.MSChar(3)), (NCHAR(2), mysql.MSChar(2)), (mysql.MSNChar(2), mysql.MSChar(2)), (mysql.MSNVarChar(22), mysql.MSString(22)), ] self._run_test(specs, ["length"])
Example #17
Source File: sqlutil.py From clgen with GNU General Public License v3.0 | 5 votes |
def UnboundedUnicodeText(): """Return an unbounded unicode text column type. This isn't truly unbounded, but 2^32 chars should be enough! Returns: A column type. """ return sql.UnicodeText().with_variant(sql.UnicodeText(2 ** 31), "mysql")
Example #18
Source File: c82c483221d6_add_namespace_ns_protection.py From wiki-scripts with GNU General Public License v3.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('namespace', sa.Column('ns_protection', sa.UnicodeText(), nullable=True)) # ### end Alembic commands ###
Example #19
Source File: ecf00882f546_.py From timesketch with Apache License 2.0 | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('view', sa.Column('query_dsl', sa.UnicodeText(), nullable=True)) op.add_column('view', sa.Column('searchtemplate_id', sa.Integer(), nullable=True)) op.create_foreign_key(None, 'view', 'searchtemplate', ['searchtemplate_id'], ['id']) ### end Alembic commands ###
Example #20
Source File: 7d48bf36b244_.py From timesketch with Apache License 2.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.alter_column('view', 'query_string', type_=sa.UnicodeText) # ### end Alembic commands ###
Example #21
Source File: 64c00337b9d1_.py From timesketch with Apache License 2.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('searchtemplate', sa.Column('description', sa.UnicodeText(), nullable=True)) # ### end Alembic commands ###
Example #22
Source File: 36e85b266dba_.py From timesketch with Apache License 2.0 | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('view', sa.Column('query_dsl', sa.UnicodeText(), nullable=True)) ### end Alembic commands ###
Example #23
Source File: 6e69f2cfcac1_.py From timesketch with Apache License 2.0 | 5 votes |
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.add_column('view', sa.Column('description', sa.UnicodeText(), nullable=True)) # ### end Alembic commands ###
Example #24
Source File: 3548e1ad8a3c_adding_resource_flags_and_hospital_.py From radremedy with Mozilla Public License 2.0 | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('resource', sa.Column('has_sliding_scale', sa.Boolean(), nullable=True)) op.add_column('resource', sa.Column('hospital_affiliation', sa.UnicodeText(), nullable=True)) op.add_column('resource', sa.Column('is_accessible', sa.Boolean(), nullable=True)) op.add_column('resource', sa.Column('is_icath', sa.Boolean(), nullable=True)) op.add_column('resource', sa.Column('is_wpath', sa.Boolean(), nullable=True)) ### end Alembic commands ###
Example #25
Source File: 2c5bd010030f_adding_resource_hours_and_npi_columns.py From radremedy with Mozilla Public License 2.0 | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('resource', sa.Column('hours', sa.UnicodeText(), nullable=True)) op.add_column('resource', sa.Column('npi', sa.Unicode(length=10), nullable=True)) ### end Alembic commands ###
Example #26
Source File: 4a09ad931d71_adding_resource_model.py From radremedy with Mozilla Public License 2.0 | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('population', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.Unicode(length=100), nullable=False), sa.Column('description', sa.UnicodeText(), nullable=True), sa.Column('keywords', sa.UnicodeText(), nullable=True), sa.Column('visible', sa.Boolean(), nullable=False), sa.Column('date_created', sa.DateTime(), nullable=False), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('name') ) ### end Alembic commands ###
Example #27
Source File: 26d585c909b0_adding_an_advisory_notes_column_for_.py From radremedy with Mozilla Public License 2.0 | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('resource', sa.Column('advisory_notes', sa.UnicodeText(), nullable=True)) ### end Alembic commands ###
Example #28
Source File: 391a19c44a98_category_keywords_field.py From radremedy with Mozilla Public License 2.0 | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('category', sa.Column('keywords', sa.UnicodeText(), nullable=True)) ### end Alembic commands ###
Example #29
Source File: 17929a019cff_adding_resource_notes_column.py From radremedy with Mozilla Public License 2.0 | 5 votes |
def upgrade(): ### commands auto generated by Alembic - please adjust! ### op.add_column('resource', sa.Column('notes', sa.UnicodeText(), nullable=True)) ### end Alembic commands ###
Example #30
Source File: f058ce7ee0c_data_in_extensions.py From kansha with BSD 3-Clause "New" or "Revised" License | 5 votes |
def downgrade(): op.add_column('card', sa.Column('description', sa.UnicodeText, default=u'')) op.drop_table('card_description') op.add_column('card', sa.Column('due_date', sa.Date)) op.drop_table('card_due_date') op.add_column('card', sa.Column('weight', sa.Unicode(255))) op.drop_table('card_weight')