thanosql.resources._view
Module Contents
Classes
Service layer for view methods. |
- class thanosql.resources._view.View
Bases:
thanosql.resources._model.BaseModel- name: str
- table_schema: str | None
- columns: List[thanosql.resources.Column] = []
- definition: str = ''
- class thanosql.resources._view.ViewService(client: thanosql._client.ThanoSQL)
Bases:
thanosql._service.ThanoSQLServiceService layer for view methods.
- list(schema: str | None = None, verbose: bool | None = None, offset: int | None = None, limit: int | None = None) List[View]
Lists views stored in the workspace.
- Parameters:
schema (str, optional) – When specified, lists views from a specific schema only. Otherwise, lists views from all available schemas.
verbose (bool, optional) – When not set or set to False (default behavior), only lists view names and the schema they belong to. When set to True, includes column descriptions and view definition in the output on top of the basic (name and schema) information.
offset (int, optional) – When set to n, skips the first n views and excludes them from the output list. Otherwise, starts the list from the first view stored. Must be greater than 0.
limit (int, optional) – When set to n, limits the number of views listed to n. Otherwise, lists up to 100 views per call. Must range between 0 to 100.
- Returns:
A list of View objects.
- Return type:
List[View]
- Raises:
ThanoSQLValueError – If offset is less than 0 or if limit is not between 0 to 100 (inclusive).
- get(name: str, schema: str | None = None) View
Shows the details of the specified view.
- Parameters:
name (str) – The name of the view to be retrieved.
schema (str, optional) – The schema the target view is stored in. When not specified, defaults to “public”.
- Returns:
A View object.
- Return type:
- delete(name: str, schema: str | None = None) dict
Deletes the specified view.
- Parameters:
name (str) – The name of the view to be deleted.
schema (str, optional) – The schema the target view is stored in. When not specified, defaults to “public”.
- Returns:
A dictionary containing a success message and the name of the deleted view in the format of:
{ "message": "string", "view_name": "string" }
- Return type:
dict