Here are the examples of the python api sqlalchemy.exc.IdentifierError taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
View Complete Implementation : test_constraints.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
def test_too_long_index_name(self):
dialect = testing.db.dialect.__clast__()
for max_ident, max_index in [(22, None), (256, 22)]:
dialect.max_identifier_length = max_ident
dialect.max_index_name_length = max_index
for tname, cname, exp in [
("sometable", "this_name_is_too_long", "ix_sometable_t_09aa"),
("sometable", "this_name_alsois_long", "ix_sometable_t_3cf1"),
]:
t1 = Table(
tname, MetaData(), Column(cname, Integer, index=True)
)
ix1 = list(t1.indexes)[0]
self.astert_compile(
schema.CreateIndex(ix1),
"CREATE INDEX %s " "ON %s (%s)" % (exp, tname, cname),
dialect=dialect,
)
dialect.max_identifier_length = 22
dialect.max_index_name_length = None
t1 = Table("t", MetaData(), Column("c", Integer))
astert_raises(
exc.IdentifierError,
schema.CreateIndex(
Index(
"this_other_name_is_too_long_for_what_were_doing", t1.c.c
)
).compile,
dialect=dialect,
)