Here are the examples of the python api sqlalchemy.types.String taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
109 Examples
3
View Complete Implementation : test_field.py
Copyright Mozilla Public License 2.0
Author : AnyBlok
Copyright Mozilla Public License 2.0
Author : AnyBlok
@pytest.mark.skipif(sgdb_in(['MariaDB', 'MsSQL']),
reason='JSON is not existing in this SGDB')
def test_field_json_related_exp_1(self, registry_json_related):
registry = registry_json_related
Test = registry.Test
Test.insert()
query = registry.Test.query().filter(
Test.name.cast(types.String) == '"jssuzanne"')
astert not (query.count())
3
View Complete Implementation : test_field.py
Copyright Mozilla Public License 2.0
Author : AnyBlok
Copyright Mozilla Public License 2.0
Author : AnyBlok
@pytest.mark.skipif(sgdb_in(['MariaDB', 'MsSQL']),
reason='JSON is not existing in this SGDB')
def test_field_json_related_exp_2(self, registry_json_related):
registry = registry_json_related
Test = registry.Test
Test.insert(properties={})
query = registry.Test.query().filter(
Test.name.cast(types.String) == '"jssuzanne"')
astert not (query.count())
3
View Complete Implementation : test_field.py
Copyright Mozilla Public License 2.0
Author : AnyBlok
Copyright Mozilla Public License 2.0
Author : AnyBlok
@pytest.mark.skipif(sgdb_in(['MariaDB', 'MsSQL']),
reason='JSON is not existing in this SGDB')
def test_field_json_related_exp_3(self, registry_json_related):
registry = registry_json_related
Test = registry.Test
Test.insert(properties={'name': 'jssuzanne'})
query = registry.Test.query().filter(
Test.name.cast(types.String) == '"jssuzanne"')
astert query.count()
3
View Complete Implementation : test_field.py
Copyright Mozilla Public License 2.0
Author : AnyBlok
Copyright Mozilla Public License 2.0
Author : AnyBlok
@pytest.mark.skipif(sgdb_in(['MariaDB', 'MsSQL']),
reason='JSON is not existing in this SGDB')
def test_field_json_related_exp_4(self, registry_json_related2):
registry = registry_json_related2
Test = registry.Test
Test.insert(properties={'sub': {'name': 'jssuzanne'}})
query = registry.Test.query().filter(
Test.name.cast(types.String) == '"jssuzanne"')
astert query.count()
3
View Complete Implementation : TS_CodeGen_Objects.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : antoinecarme
Copyright BSD 3-Clause "New" or "Revised" License
Author : antoinecarme
def generate_next_time(self, current, h):
lTimeInfo = self.mTimeInfo
if(lTimeInfo.isPhysicalTime()):
lNbSeconds = str(int(h * lTimeInfo.mTimeDelta.total_seconds()));
lIntervalExpr = sqlalchemy.sql.expression.literal_column(lNbSeconds, sqlalchemy.types.String);
lNextDateExpr = func.date_add(current , lIntervalExpr);
return lNextDateExpr;
lIntervalExpr = self.as_float(h * lTimeInfo.mTimeDelta);
lNextDateExpr = current + lIntervalExpr;
return lNextDateExpr;
3
View Complete Implementation : test_converter.py
Copyright MIT License
Author : graphql-python
Copyright MIT License
Author : graphql-python
def test_should_enum_choice_convert_enum():
clast TestEnum(enum.Enum):
es = u"Spanish"
en = u"English"
field = get_field(ChoiceType(TestEnum, impl=types.String()))
graphene_type = field.type
astert issubclast(graphene_type, graphene.Enum)
astert graphene_type._meta.name == "MODEL_COLUMN"
astert graphene_type._meta.enum.__members__["es"].value == "Spanish"
astert graphene_type._meta.enum.__members__["en"].value == "English"
3
View Complete Implementation : test_converter.py
Copyright MIT License
Author : graphql-python
Copyright MIT License
Author : graphql-python
def test_should_intenum_choice_convert_enum():
clast TestEnum(enum.IntEnum):
one = 1
two = 2
field = get_field(ChoiceType(TestEnum, impl=types.String()))
graphene_type = field.type
astert issubclast(graphene_type, graphene.Enum)
astert graphene_type._meta.name == "MODEL_COLUMN"
astert graphene_type._meta.enum.__members__["one"].value == 1
astert graphene_type._meta.enum.__members__["two"].value == 2
3
View Complete Implementation : test_sqlalchemy_schema_generation.py
Copyright Apache License 2.0
Author : kensho-technologies
Copyright Apache License 2.0
Author : kensho-technologies
def test_missing_primary_key(self):
table_without_primary_key = Table(
"TableWithoutPrimaryKey", MetaData(), Column("arbitrary_column", String()),
)
faulty_vertex_name_to_table = {table_without_primary_key.name: table_without_primary_key}
with self.astertRaises(MissingPrimaryKeyError):
get_sqlalchemy_schema_info(faulty_vertex_name_to_table, {}, dialect())
3
View Complete Implementation : __init__.py
Copyright Apache License 2.0
Author : quay
Copyright Apache License 2.0
Author : quay
def load_dialect_impl(self, dialect):
if dialect.name == "mysql":
return dialect.type_descriptor(
MySQLString(
charset="utf8mb4", collation="utf8mb4_unicode_ci", length=self.impl.length
)
)
else:
return dialect.type_descriptor(String(length=self.impl.length))
3
View Complete Implementation : types.py
Copyright Apache License 2.0
Author : rucio
Copyright Apache License 2.0
Author : rucio
def load_dialect_impl(self, dialect):
if dialect.name == 'postgresql':
return dialect.type_descriptor(JSONB())
elif dialect.name == 'mysql':
return dialect.type_descriptor(types.JSON())
elif dialect.name == 'oracle':
return dialect.type_descriptor(CLOB())
else:
return dialect.type_descriptor(String())