Exemplo n.º 1
0
def test_table():
    json = """
        {
            "name" : "table_name",
            "share" : "share_name",
            "schema" : "schema_name"
        }
        """
    table = Table.from_json(json)
    assert table == Table("table_name", "share_name", "schema_name")
Exemplo n.º 2
0
    def list_all_tables(
            self,
            share: Share,
            *,
            max_results: Optional[int] = None,
            page_token: Optional[str] = None) -> ListAllTablesResponse:
        data: Dict = {}
        if max_results is not None:
            data["maxResults"] = max_results
        if page_token is not None:
            data["pageToken"] = page_token

        with self._get_internal(f"/shares/{share.name}/all-tables",
                                data) as lines:
            tables_json = json.loads(next(lines))
            return ListAllTablesResponse(
                tables=[
                    Table.from_json(table_json)
                    for table_json in tables_json.get("items", [])
                ],
                next_page_token=tables_json.get("nextPageToken", None),
            )