Skip to main content

client

class atscale.client.client.Client

Creates a Client with a connection to an AtScale server to allow for interaction with the the server.

connect

Initializes the Client object’s connection

get_catalogs

Returns a list of dicts for each of the listed catalogs and their repos.

  • Parameters: include_soft_publish (bool , optional) – Whether to include soft published catalogs. Defaults to False.
  • Returns: List of 4 item dicts where keys are ‘catalog_id’, ‘catalog_name’, ‘repo_id’, ‘repo_name’ of available catalogs.
  • Return type: List[Dict[str,str]]

get_connected_databases

Get a list of databases the client can access in the provided warehouse.

  • Parameters: warehouse_id (str) – The AtScale warehouse connection to use.
  • Returns: The list of available databases
  • Return type: List[str]

get_connected_schemas

Get a list of schemas the client can access in the provided warehouse and database.

  • Parameters:
    • warehouse_id (str) – The AtScale warehouse connection to use.
    • database (str) – The database to use.
  • Returns: The list of available tables
  • Return type: List[str]

get_connected_tables

Get a list of tables the client can access in the provided warehouse, database, and schema.

  • Parameters:
    • warehouse_id (str) – The AtScale warehouse connection to use.
    • database (str) – The database to use.
    • schema (str) – The schema to use.
  • Returns: The list of available tables
  • Return type: List[str]

get_connected_warehouses

Returns metadata on all warehouses visible to the connected client

  • Returns: The list of available warehouses
  • Return type: List[Dict]

get_query_columns

Returns a list of all columns involved in the provided query against the given warehouse_id. The columns are returned as they are represented by AtScale.

  • Parameters:
    • warehouse_id (str) – The AtScale warehouse to use.
    • query (str) – A valid query for the warehouse of the given id, of which to return the resulting columns
  • Returns: A list of columns represented as Tuples of (name, data-type)
  • Return type: List[Tuple]

get_repos

Returns a list of dicts for each of the available repos.

  • Returns: List of 2 item dicts where keys are ‘id’, ‘name’ of available repos.
  • Return type: List[Dict[str,str]]

get_table_columns

Get a list of columns the client can access in the provided warehosue, database, schema, and table.

  • Parameters:
    • warehouse_id (str) – The AtScale warehouse to use.
    • database (str) – The database to use.
    • schema (str) – The schema to use.
    • table_name (str) – The name of the table to use.
  • Returns: Pairs of the columns and data-types (respectively) of the passed table
  • Return type: List[Tuple]

get_version

A getter function for the current version of the library

  • Returns: The current version of the library
  • Return type: str

select_repo

Prompts the user to select a repo that the client can access.

  • Parameters:
    • repo_id (str , optional) – A repo id, will select the repo with the matching id. If None, asks user to select from list. Defaults to None.
    • name_contains (str , optional) – A string to use for string comparison to filter the found repo names. Defaults to None.
  • Returns: the selected Repo
  • Return type: Repo