本文整理汇总了Python中sqlalchemy.types.adapt_type函数的典型用法代码示例。如果您正苦于以下问题:Python adapt_type函数的具体用法?Python adapt_type怎么用?Python adapt_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adapt_type函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: type_descriptor
def type_descriptor(self, typeobj):
if isinstance(typeobj, type):
typeobj = typeobj()
if isinstance(typeobj, sqltypes.Unicode):
return typeobj.adapt(MaxUnicode)
else:
return sqltypes.adapt_type(typeobj, colspecs)
示例2: type_descriptor
def type_descriptor(self, typeobj):
"""Provide a database-specific ``TypeEngine`` object, given
the generic object which comes from the types module.
This method looks for a dictionary called
``colspecs`` as a class or instance-level variable,
and passes on to ``types.adapt_type()``.
"""
return sqltypes.adapt_type(typeobj, self.colspecs)
示例3: type_descriptor
def type_descriptor(self, typeobj):
return sqltypes.adapt_type(typeobj, colspecs)
示例4: type_descriptor
def type_descriptor(self, typeobj):
newobj = types.adapt_type(typeobj, self.colspecs)
return newobj
示例5: type_descriptor
def type_descriptor(self, typeobj):
newobj = sqltypes.adapt_type(typeobj, self.colspecs)
# Some types need to know about the dialect
if isinstance(newobj, (MSText, MSNVarchar)):
newobj.dialect = self
return newobj
示例6: type_descriptor
def type_descriptor(self, typeobj):
""" Inputs: generic type to be converted
Returns: converted adapter type
"""
return sa_types.adapt_type(typeobj, colspecs)
示例7: type_descriptor
def type_descriptor(self, typeobj):
if self.version == 2:
return sqltypes.adapt_type(typeobj, pg2_colspecs)
else:
return sqltypes.adapt_type(typeobj, pg1_colspecs)