python类CHAR的实例源码

uuid_database_type.py 文件源码 项目:TopChef 作者: TopChef 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def load_dialect_impl(self, dialect: dialects) -> DialectType:
        """
        SQLAlchemy wraps all database-specific features into
        dialects, which are then responsible for generating the SQL code
        for a specific DB type when loading in data. ``load_dialect_impl``
        is called when CRUD (create, update, delete operations) needs to be
        done on the database. This method is responsible for telling
        SQLAlchemy how to configure the dialect to write this type

        :param dialect: The loaded dialect
        :return: The type descriptor for this type.
        """
        if dialect.name == 'postgresql':
            return dialect.type_descriptor(postgresql.UUID())
        else:
            return dialect.type_descriptor(CHAR(32))
base.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, length=None, **kwargs):
        super(CHAR, self).__init__(length=length, **kwargs)
base.py 文件源码 项目:Flask_Blog 作者: sugarguo 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def normalize_name(self, name):
        # Remove trailing spaces: FB uses a CHAR() type,
        # that is padded with spaces
        name = name and name.rstrip()
        if name is None:
            return None
        elif name.upper() == name and \
                not self.identifier_preparer._requires_quotes(name.lower()):
            return name.lower()
        else:
            return name
postgres.py 文件源码 项目:annotated-py-sqlalchemy 作者: hhstore 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def get_col_spec(self):
        return "CHAR(%(length)s)" % {'length' : self.length}
mysql.py 文件源码 项目:annotated-py-sqlalchemy 作者: hhstore 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def get_col_spec(self):
        return "CHAR(%(length)s)" % {'length' : self.length}
sqlite.py 文件源码 项目:annotated-py-sqlalchemy 作者: hhstore 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def get_col_spec(self):
        return "CHAR(%(length)s)" % {'length' : self.length}
oracle.py 文件源码 项目:annotated-py-sqlalchemy 作者: hhstore 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def get_col_spec(self):
        return "CHAR(%(length)s)" % {'length' : self.length}
custom_types.py 文件源码 项目:Brightside 作者: BrighterCommand 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def load_dialect_impl(self, dialect):
        if dialect.name == 'postgresql':
            return dialect.type_descriptor(UUID())
        else:
            return dialect.type_descriptor(CHAR(32))
base.py 文件源码 项目:QXSConsolas 作者: qxsch 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, length=None, **kwargs):
        super(CHAR, self).__init__(length=length, **kwargs)
base.py 文件源码 项目:QXSConsolas 作者: qxsch 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def normalize_name(self, name):
        # Remove trailing spaces: FB uses a CHAR() type,
        # that is padded with spaces
        name = name and name.rstrip()
        if name is None:
            return None
        elif name.upper() == name and \
                not self.identifier_preparer._requires_quotes(name.lower()):
            return name.lower()
        else:
            return name
base.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def __init__(self, length=None, **kwargs):
        super(CHAR, self).__init__(length=length, **kwargs)
base.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def normalize_name(self, name):
        # Remove trailing spaces: FB uses a CHAR() type,
        # that is padded with spaces
        name = name and name.rstrip()
        if name is None:
            return None
        elif name.upper() == name and \
                not self.identifier_preparer._requires_quotes(name.lower()):
            return name.lower()
        else:
            return name
base.py 文件源码 项目:flasky 作者: RoseOu 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def __init__(self, length=None, **kwargs):
        """Construct a CHAR.

        :param length: Maximum data length, in characters.

        :param binary: Optional, use the default binary collation for the
          national character set.  This does not affect the type of data
          stored, use a BINARY type for binary data.

        :param collation: Optional, request a particular collation.  Must be
          compatible with the national character set.

        """

        super(CHAR, self).__init__(length=length, **kwargs)
first_sqlalchemy.py 文件源码 项目:Python_Study 作者: thsheep 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def key_deal():
    from_ = Column('from', CHAR(10))

#??????
#Column?????????????????????
base.py 文件源码 项目:oa_qian 作者: sunqb 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, length=None, **kwargs):
        super(CHAR, self).__init__(length=length, **kwargs)
base.py 文件源码 项目:oa_qian 作者: sunqb 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def normalize_name(self, name):
        # Remove trailing spaces: FB uses a CHAR() type,
        # that is padded with spaces
        name = name and name.rstrip()
        if name is None:
            return None
        elif name.upper() == name and \
                not self.identifier_preparer._requires_quotes(name.lower()):
            return name.lower()
        else:
            return name
base.py 文件源码 项目:oa_qian 作者: sunqb 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, length=None, **kwargs):
        """Construct a CHAR.

        :param length: Maximum data length, in characters.

        :param binary: Optional, use the default binary collation for the
          national character set.  This does not affect the type of data
          stored, use a BINARY type for binary data.

        :param collation: Optional, request a particular collation.  Must be
          compatible with the national character set.

        """

        super(CHAR, self).__init__(length=length, **kwargs)
base.py 文件源码 项目:chihu 作者: yelongyu 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, length=None, **kwargs):
        super(CHAR, self).__init__(length=length, **kwargs)
base.py 文件源码 项目:chihu 作者: yelongyu 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def normalize_name(self, name):
        # Remove trailing spaces: FB uses a CHAR() type,
        # that is padded with spaces
        name = name and name.rstrip()
        if name is None:
            return None
        elif name.upper() == name and \
                not self.identifier_preparer._requires_quotes(name.lower()):
            return name.lower()
        else:
            return name
base.py 文件源码 项目:ShelbySearch 作者: Agentscreech 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, length=None, **kwargs):
        super(CHAR, self).__init__(length=length, **kwargs)
base.py 文件源码 项目:ShelbySearch 作者: Agentscreech 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def normalize_name(self, name):
        # Remove trailing spaces: FB uses a CHAR() type,
        # that is padded with spaces
        name = name and name.rstrip()
        if name is None:
            return None
        elif name.upper() == name and \
                not self.identifier_preparer._requires_quotes(name.lower()):
            return name.lower()
        elif name.lower() == name:
            return quoted_name(name, quote=True)
        else:
            return name
base.py 文件源码 项目:pyetje 作者: rorlika 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, length=None, **kwargs):
        super(CHAR, self).__init__(length=length, **kwargs)
base.py 文件源码 项目:pyetje 作者: rorlika 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def normalize_name(self, name):
        # Remove trailing spaces: FB uses a CHAR() type,
        # that is padded with spaces
        name = name and name.rstrip()
        if name is None:
            return None
        elif name.upper() == name and \
            not self.identifier_preparer._requires_quotes(name.lower()):
            return name.lower()
        else:
            return name
base.py 文件源码 项目:pyetje 作者: rorlika 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, length=None, **kwargs):
        """Construct a CHAR.

        :param length: Maximum data length, in characters.

        :param binary: Optional, use the default binary collation for the
          national character set.  This does not affect the type of data
          stored, use a BINARY type for binary data.

        :param collation: Optional, request a particular collation.  Must be
          compatible with the national character set.

        """

        super(CHAR, self).__init__(length=length, **kwargs)
base.py 文件源码 项目:Price-Comparator 作者: Thejas-1 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, length=None, **kwargs):
        super(CHAR, self).__init__(length=length, **kwargs)
base.py 文件源码 项目:Price-Comparator 作者: Thejas-1 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def normalize_name(self, name):
        # Remove trailing spaces: FB uses a CHAR() type,
        # that is padded with spaces
        name = name and name.rstrip()
        if name is None:
            return None
        elif name.upper() == name and \
                not self.identifier_preparer._requires_quotes(name.lower()):
            return name.lower()
        else:
            return name
test_uuid_database_type.py 文件源码 项目:TopChef 作者: TopChef 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def test_name_sqlite(self) -> None:
        """
        Tests that if the name ``sqlite`` is given to the database, then a
        CHAR descriptor comes back out with 32 characters
        """
        uuid_instance = DB_UUID()
        dialect_impl = uuid_instance.load_dialect_impl(self.sqlite_dialect)
        self.assertIsInstance(
            dialect_impl, self.sqlite_dialect.type_descriptor(
                CHAR(32)
            ).__class__
        )
test_uuid_database_type.py 文件源码 项目:TopChef 作者: TopChef 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def test_bind_uuid_something_else(self, uuid: UUID) -> None:
        """
        Tests that the UUID gets de-hyphenated if using the CHAR 32 type, same
        as always.

        :param uuid: A randomly-generated UUID to store
        """
        db_uuid = DB_UUID()
        value_to_store = db_uuid.process_bind_param(
            uuid, self.sqlite_dialect
        )
        self.assertEqual(
            value_to_store, "%.32x" % int(uuid)
        )
custom_types.py 文件源码 项目:quark 作者: openstack 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def load_dialect_impl(self, dialect):
        # IPv6 is 128 bits => 2^128 == 3.4e38 => 39 digits
        return dialect.type_descriptor(types.CHAR(39))
custom_types.py 文件源码 项目:quark 作者: openstack 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def load_dialect_impl(self, dialect):
        if dialect.name == 'sqlite':
            return dialect.type_descriptor(sqlite.CHAR)
        return dialect.type_descriptor(self.impl)


问题


面经


文章

微信
公众号

扫码关注公众号