dremio_client.util package

Submodules

dremio_client.util.query module

dremio_client.util.query.refresh_metadata(token, base_url, table, ssl_verify=True)[source]

Refresh the metadata of a given PDS

This requests a metadata refresh of a given Physical Dataset

Parameters:
  • token – API token from auth
  • base_url – base url of Dremio instance
  • table – valid dremio table name
  • ssl_verify – verify ssl on web requests
Raise:

DremioException if job failed

Raise:

DremioUnauthorizedException if token is incorrect or invalid

Returns:

None

Example:
>>> refresh_metadata('abc', 'http://localhost:9047', 'source.pds')
dremio_client.util.query.run(token, base_url, query, context=None, sleep_time=10, ssl_verify=True)[source]

Run a single sql query

This runs a single sql query against the rest api and returns a json document of the results

Parameters:
  • token – API token from auth
  • base_url – base url of Dremio instance
  • query – valid sql query
  • context – optional context in which to execute the query
  • sleep_time – seconds to sleep between checking for finished state
  • ssl_verify – verify ssl on web requests
Raise:

DremioException if job failed

Raise:

DremioUnauthorizedException if token is incorrect or invalid

Returns:

json array of result rows

Example:
>>> run('abc', 'http://localhost:9047', 'select * from sys.options')
[{'record':'1'}, {'record':'2'}]
dremio_client.util.query.run_async(token, base_url, query, context=None, sleep_time=10, ssl_verify=True)[source]

Run a single sql query asynchronously

This executes a single sql query against the rest api asynchronously and returns a future for the result

Parameters:
  • token – API token from auth
  • base_url – base url of Dremio instance
  • query – valid sql query
  • context – optional context in which to execute the query
  • sleep_time – seconds to sleep between checking for finished state
  • ssl_verify – verify ssl on web requests
Raise:

DremioException if job failed

Raise:

DremioUnauthorizedException if token is incorrect or invalid

Returns:

concurrent.futures.Future for the result

Example:
>>> f = run_async('abc', 'http://localhost:9047', 'select * from sys.options')
>>> f.result()
[{'record':'1'}, {'record':'2'}]

dremio_client.util.refresh module

Warning

dremio_client.util.refresh.refresh_reflections_of_one_dataset Caution using this function. It can has an critical impact on source system due to disabled reflection.

Module contents

dremio_client.util.run(token, base_url, query, context=None, sleep_time=10, ssl_verify=True)[source]

Run a single sql query

This runs a single sql query against the rest api and returns a json document of the results

Parameters:
  • token – API token from auth
  • base_url – base url of Dremio instance
  • query – valid sql query
  • context – optional context in which to execute the query
  • sleep_time – seconds to sleep between checking for finished state
  • ssl_verify – verify ssl on web requests
Raise:

DremioException if job failed

Raise:

DremioUnauthorizedException if token is incorrect or invalid

Returns:

json array of result rows

Example:
>>> run('abc', 'http://localhost:9047', 'select * from sys.options')
[{'record':'1'}, {'record':'2'}]
dremio_client.util.run_async(token, base_url, query, context=None, sleep_time=10, ssl_verify=True)[source]

Run a single sql query asynchronously

This executes a single sql query against the rest api asynchronously and returns a future for the result

Parameters:
  • token – API token from auth
  • base_url – base url of Dremio instance
  • query – valid sql query
  • context – optional context in which to execute the query
  • sleep_time – seconds to sleep between checking for finished state
  • ssl_verify – verify ssl on web requests
Raise:

DremioException if job failed

Raise:

DremioUnauthorizedException if token is incorrect or invalid

Returns:

concurrent.futures.Future for the result

Example:
>>> f = run_async('abc', 'http://localhost:9047', 'select * from sys.options')
>>> f.result()
[{'record':'1'}, {'record':'2'}]
dremio_client.util.refresh_metadata(token, base_url, table, ssl_verify=True)[source]

Refresh the metadata of a given PDS

This requests a metadata refresh of a given Physical Dataset

Parameters:
  • token – API token from auth
  • base_url – base url of Dremio instance
  • table – valid dremio table name
  • ssl_verify – verify ssl on web requests
Raise:

DremioException if job failed

Raise:

DremioUnauthorizedException if token is incorrect or invalid

Returns:

None

Example:
>>> refresh_metadata('abc', 'http://localhost:9047', 'source.pds')
dremio_client.util.promote_catalog(client, catalog, file_format='parquet', **kwargs)[source]
dremio_client.util.refresh_vds_reflection_by_path(client, path=None)[source]

By providing a path from VDS the reflection of that vds will be refreshed Script will find which pds is responsible for the reflection and trigger the refresh based on pds

Parameters:path – list [‘space’, ‘folder’, ‘vds’]
dremio_client.util.refresh_reflections_of_one_dataset(client, path=None)[source]

By providing a path from dataset the reflection of that dataset will be refreshed through reenable Enebled reflections of dataset and all reflections from derived dataset will be refreshed

Parameters:path – list [‘space’, ‘folder’, ‘vds’]