當前位置: 首頁>>代碼示例>>Python>>正文


Python DataLinker.get_db_class_query方法代碼示例

本文整理匯總了Python中dNG.data.data_linker.DataLinker.get_db_class_query方法的典型用法代碼示例。如果您正苦於以下問題:Python DataLinker.get_db_class_query方法的具體用法?Python DataLinker.get_db_class_query怎麽用?Python DataLinker.get_db_class_query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dNG.data.data_linker.DataLinker的用法示例。


在下文中一共展示了DataLinker.get_db_class_query方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: load_owner_root_directory

# 需要導入模塊: from dNG.data.data_linker import DataLinker [as 別名]
# 或者: from dNG.data.data_linker.DataLinker import get_db_class_query [as 別名]
    def load_owner_root_directory(cls, owner_id):
        """
Load Entry instance of the root directory for the given owner ID.

:param cls: Expected encapsulating database instance class
:param owner_id: Owner ID

:return: (object) Entry instance on success
:since:  v0.1.00
        """

        if (owner_id is None): raise NothingMatchedException("Owner ID is invalid")

        with Connection.get_instance():
            db_instance = (DataLinker.get_db_class_query(cls)
                           .filter(_DbFileCenterEntry.vfs_type == Entry.VFS_TYPE_DIRECTORY,
                                   _DbFileCenterEntry.role_id == "owner_root",
                                   _DbFileCenterEntry.owner_type == "u",
                                   _DbFileCenterEntry.owner_id == owner_id
                                  )
                           .first()
                          )

            if (db_instance is None): raise NothingMatchedException("Owner ID '{0}' is invalid".format(owner_id))
            DataLinker._ensure_db_class(cls, db_instance)

            return Entry(db_instance)
開發者ID:dNG-git,項目名稱:pas_file_center,代碼行數:29,代碼來源:entry.py

示例2: load_vfs_url

# 需要導入模塊: from dNG.data.data_linker import DataLinker [as 別名]
# 或者: from dNG.data.data_linker.DataLinker import get_db_class_query [as 別名]
    def load_vfs_url(cls, url):
        """
Load Entry instance by its VFS URL.

:param cls: Expected encapsulating database instance class
:param url: VFS URL

:return: (object) Entry instance on success
:since:  v0.1.00
        """

        if (url is None): raise NothingMatchedException("VFS URL is invalid")

        with Connection.get_instance():
            db_instance = DataLinker.get_db_class_query(cls).filter(_DbFileCenterEntry.vfs_url == url).first()

            if (db_instance is None): raise NothingMatchedException("VFS URL '{0}' is invalid".format(url))
            DataLinker._ensure_db_class(cls, db_instance)

            return Entry(db_instance)
開發者ID:dNG-git,項目名稱:pas_file_center,代碼行數:22,代碼來源:entry.py

示例3: load_role_id

# 需要導入模塊: from dNG.data.data_linker import DataLinker [as 別名]
# 或者: from dNG.data.data_linker.DataLinker import get_db_class_query [as 別名]
    def load_role_id(cls, _id):
        """
Load Entry instance by its role ID.

:param cls: Expected encapsulating database instance class
:param _id: Role ID

:return: (object) Entry instance on success
:since:  v0.1.00
        """

        if (_id is None): raise NothingMatchedException("Role ID is invalid")

        with Connection.get_instance():
            db_instance = DataLinker.get_db_class_query(cls).filter(_DbFileCenterEntry.role_id == _id).first()

            if (db_instance is None): raise NothingMatchedException("Role ID '{0}' is invalid".format(_id))
            DataLinker._ensure_db_class(cls, db_instance)

            return Entry(db_instance)
開發者ID:dNG-git,項目名稱:pas_file_center,代碼行數:22,代碼來源:entry.py

示例4: load_id_subscription

# 需要導入模塊: from dNG.data.data_linker import DataLinker [as 別名]
# 或者: from dNG.data.data_linker.DataLinker import get_db_class_query [as 別名]
	def load_id_subscription(cls, _id):
	#
		"""
Load List instance by its subscription ID.

:param cls: Expected encapsulating database instance class
:param _id: Subscription ID

:return: (object) List instance on success
:since:  v0.1.00
		"""

		if (_id is None): raise NothingMatchedException("List subscription ID is invalid")

		with Connection.get_instance():
		#
			db_instance = DataLinker.get_db_class_query(cls).filter(_DbDiscussList.id_subscription == _id).first()

			if (db_instance is None): raise NothingMatchedException("List subscription '{0}' is invalid".format(_id))
			DataLinker._ensure_db_class(cls, db_instance)

			return List(db_instance)
開發者ID:dNG-git,項目名稱:pas_discuss,代碼行數:24,代碼來源:list.py


注:本文中的dNG.data.data_linker.DataLinker.get_db_class_query方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。