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


Python DataHubConnection.create_view方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: from core.db.connection import DataHubConnection [as 別名]
# 或者: from core.db.connection.DataHubConnection import create_view [as 別名]

#.........這裏部分代碼省略.........
        """
        return sorted(self.user_con.list_tables(repo=repo))

    def describe_table(self, repo, table, detail=False):
        """
        Lists a table's schema. If detail=True, provides all schema info.

        Default return includes column names and types only.

        Returns empty list on insufficient permissions.
        Raises ValueError if repo or table are missing or the empty string.
        """
        if repo.strip() in ['', None]:
            raise ValueError("repo cannot be empty.")
        if table.strip() in ['', None]:
            raise ValueError("table cannot be empty.")
        return self.user_con.describe_table(repo, table, detail)

    def list_table_permissions(self, repo, table):
        """
        Lists the current user's permissions on a table.

        Default return includes column names and types only.

        Returns empty list on insufficient permissions.
        Raises ValueError if repo or table are missing or the empty string.
        """
        if repo.strip() in ['', None]:
            raise ValueError("repo cannot be empty.")
        if table.strip() in ['', None]:
            raise ValueError("table cannot be empty.")
        return self.user_con.list_table_permissions(repo, table)

    def create_view(self, repo, view, sql):
        """
        Creates a view in the current repo_base from a given query.

        Returns True on success.

        Raises ValueError if repo or view have invalid characters.
        Raises ProgrammingError if the repo doesn't exist.
        Raises ProgrammingError if the view already exists.
        Raises ProgrammingError if the query has syntax errors.
        Raises PermissionDenied on insufficient permissions.
        """
        return self.user_con.create_view(
            repo=repo, view=view, sql=sql)

    def list_views(self, repo):
        """
        Lists the views in a repo.

        Returns a list of view names.

        Raises LookupError on insufficient permissions or if the repo doesn't
        exist.
        """
        return sorted(self.user_con.list_views(repo=repo))

    def describe_view(self, repo, view, detail=False):
        """
        Lists a view's schema. If detail=True, provides all schema info.

        Default return includes column names and types only.

        Returns empty list on insufficient permissions.
開發者ID:datahuborg,項目名稱:datahub,代碼行數:70,代碼來源:manager.py


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