mstrio.modeling.schema.table package

Submodules

mstrio.modeling.schema.table.logical_table module

class mstrio.modeling.schema.table.logical_table.LogicalTable(connection: Connection, id: str | None = None, name: str | None = None, project_id: str | None = None, project_name: str | None = None)

Bases: Entity, DeleteMixin, MoveMixin, TranslationMixin

An object representation of a logical table, referred to as Table in Command Manager. A logical table describes the higher-level data model objects (facts, attributes, etc.) that the architect wishes to use to model the contents of the physical table.

A logical table cannot exist without a physical table. Each logical table is mapped to exactly one physical table. However, a physical table may be mapped to many logical tables (each additional one is called logical table alias). This class exposes interface to create both logical and logical table alias.

After performing a write operation on a LogicalTable object, you may want to reload the schema using mstrio.modeling.schema.schema_management module.

name

name of the logical table

id

id of the logical table

description

description of the logical table

sub_type

string literal used to identify the type of a metadata object, ObjectSubType enum

version

object version ID

ancestors

list of ancestor folders

type

object type, ObjectTypes enum

ext_type

object extended type, ExtendedType enum

date_created

creation time, DateTime object

date_modified

last modification time, DateTime object

owner

User object that is the owner

acg

access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

object access control list

version_id

the version number this object is currently carrying

is_embedded

if true indicates that the target object of this reference is embedded within this object, if this field is omitted (as is usual) then the target is not embedded.

path

the path of the object, read only

primary_locale

the primary locale of the object, in the IETF BCP 47 language tag format, such as “en-US”, read only

destination_folder_id

a globally unique identifier used to distinguish between metadata objects within the same project

logical_size

a size based on the columns in the tables and the attributes to which those columns correspond. Uses the conceptual or logical attribute definitions to assign a size to each table in the project.

is_logical_size_locked

An indication if the logical table size of a table is locked or not. When a table’s logical size is locked, the table is excluded from the logical table size calculation when a schema update is performed.

is_part_of_partition

An indication whether this table is part of a partition table.

is_true_key

An indication whether a specified primary key is the true key.

table_key

A list of objects representing table keys defined on physical table

partition_level

List of objects representing partition attributes

attributes

list of objects representing business concepts reflected in data. Attributes provide a context in which to report on and analyze business facts or calculations.

facts

list of objects representing essential elements within the business data model and basis for almost all metrics. They relate numeric data values from the data warehouse to the MicroStrategy reporting environment. E.g. sales dollars, units sold, profit etc.

primary_data_source

Table’s data can be from different data sources. Primary data source is the first option for table’s data source.

enclose_sql_in_parentheses

This property is only applied if a logical table is based upon a free form sql table. By default, this property value is set to true. This encloses the entire SQL that you typed in the sqlStatement field in parentheses when the SQL statement is executed.

physical_table

Metadata of a physical table based on warehouse’s physical table or free form sql.

partition_tables

A list of objects representing partition’s tables metadata

secondary_data_sources

MicroStrategy support mapping the table to more than one data source. This attribute is a list of object representations of a reference to a datasource.

hidden

Specifies whether the object is hidden

alter(name: str | None = None, is_true_key: bool | None = None, logical_size: int | None = None, description: str | None = None, is_logical_size_locked: bool | None = None, primary_data_source: mstrio.modeling.schema.helpers.SchemaObjectReference | None = None, secondary_data_sources: None | list[mstrio.modeling.schema.helpers.SchemaObjectReference] | list[dict] = None, physical_table_object_name: str | None = None, physical_table_name: str | None = None, physical_table_prefix: str | None = None, sql_statement: str | None = None, enclose_sql_in_parentheses: bool | None = None, columns: list[mstrio.modeling.schema.helpers.TableColumn] | list[dict] | None = None, folder_id: str | None = None, hidden: bool | None = None, comments: str | None = None) None

Alters properties specified by keyword arguments.

Parameters:
  • name (Optional[str], optional) – Name of a logical table. Defaults to None.

  • is_true_key (Optional[bool]) – MicroStrategy requires each table to have a primary key, which is a unique value identifying each distinct data record or row. A primary key can be defined by one or more columns in the table. MicroStrategy determines the primary key for a table based on the attribute’s mapped to the columns of the table. The key is made up of the lowest level attributes. If these columns are mapped to attributes in MicroStrategy, then the primary key is represented correctly. In this case, if isTrueKey is returned as true, it indicates specified primary key is the true key. Defaults to None.

  • logical_size (Optional[int], optional) – Size of a logical table. Defaults to None.

  • description (str, optional) – Logical table description

  • is_logical_size_locked (Optional[bool], optional) – An indication if the logical table size of a table is locked or not. When a table’s logical size is locked, the table is excluded from the logical table size calculation when a schema update is performed. Defaults to None.

  • primary_data_source (Optional[SchemaObjectReference], optional) – Table’s data can be from different data sources. Primary data source is the first option for table’s data source. Defaults to None.

  • | (secondary_data_sources (Optional[List[SchemaObjectReference]) – List[dict]], optional): MicroStrategy support mapping the table to more than one data source. This attribute is a list of object representations of a reference to a datasource. Defaults to None

  • physical_table_object_name (Optional[str], optional) – A new name of an object (on MSTR server) that represents a physical table mapped to the logical table. Defaults to None.

  • physical_table_name (Optional[str], optional) – A new name of a physical table mapped to the logical table. Defaults to None.

  • physical_table_prefix (Optional[str], optional) – A new prefix for a physical table mapped to the logical table. Defaults to None.

  • sql_statement (Optional[str], optional) – A new SQL statement for physical table mapped to the logical table. Defaults to None.

  • enclose_sql_in_parentheses (Optional[bool], optional) – This encloses the entire SQL that you typed in the sqlStatement field in parentheses when the SQL statement is executed.

  • columns (Optional[List[TableColumn] | List[dict]], optional) – A list of new columns of a physical table mapped to the logical table. Defaults to None.

  • folder_id (Optional[str], optional) – The ID of a folder to which a logical table should be moved. Defaults to None.

  • hidden (bool, optional) – Specifies whether the object is hidden. Default value: False.

  • comments (str, optional) – Comments added to the object. Defaults to None.

  • Throws

    TypeError if:
    • Attempting to alter a logical table when it depends upon a

      physical table which type is “Warehouse Partition Table”

    • Attempting to alter physical_table_name or

      physical_table_prefix when the logical table depends upon a freeform sql physical table.

    • Attempting to alter sql_statement or columns when the

      logical table depends upon a normal physical table.

  • Examples

    >>> LogicalTable(connection,
                     id='FF529E1446BE3DF75ECD4B8E18618747').alter(
                         name="Altered Name"
                     )
    

classmethod create(connection: Connection, primary_data_source: mstrio.modeling.schema.helpers.SchemaObjectReference | dict, table_name: str | None = None, table_description: str | None = None, sub_type: mstrio.modeling.schema.helpers.ObjectSubType | str | None = ObjectSubType.LOGICAL_TABLE, destination_folder: mstrio.object_management.folder.Folder | str | None = None, is_embedded: bool | None = None, physical_table: mstrio.modeling.schema.table.physical_table.PhysicalTable | dict | None = None, physical_table_name: str | None = None, physical_table_namespace: str | None = None, physical_table_type: mstrio.modeling.schema.helpers.PhysicalTableType | None = PhysicalTableType.NORMAL, physical_table_prefix: str | None = None, columns: list[mstrio.modeling.schema.helpers.TableColumn] | list[dict] | None = None, sql_statement: str | None = None, logical_size: int | None = None, is_part_of_partition: bool | None = None, is_true_key: bool | None = None, enclose_sql_in_parentheses: bool | None = None, check_secondary_data_source_table: bool | None = None, column_merge_option: None | mstrio.modeling.schema.helpers.TableColumnMergeOption = TableColumnMergeOption.REUSE_ANY, table_prefix_option: mstrio.modeling.schema.helpers.TablePrefixOption | None = None) LogicalTable

Create a new table in a specific project.

Parameters:
  • connection (object) – MicroStrategy connection object returned by connection.Connection().

  • primary_data_source (object) – Information about an object referenced within the specification of another object. An object reference typically contains only enough fields to uniquely identify the referenced objects.

  • table_name (str, optional) – Logical table name

  • table_description (str, optional) – Logical table description

  • sub_type (enum, str, optional) – String literal used to identify the type of a metadata object.

  • destination_folder (object, str, optional) – Globally unique identifier used to distinguish between metadata objects within the same project

  • is_embedded (bool, optional) – if true indicates that the target object of this reference is embedded within this object

  • physical_table (object, dict, optional) – Physical table

  • physical_table_name (str, optional) – Table name

  • physical_table_namespace (str, optional) – Datasource namespace

  • physical_table_type (enum, optional) – Table type

  • physical_table_prefix (str, optional) – Table prefix of the table

  • columns (object, optional) – Columns

  • sql_statement (str, optional) – SQL statement that will be executed against the warehouse to get column data of the physical table.

  • logical_size (int, optional) – Size of a table

  • is_part_of_partition (bool, optional) – whether current table is part of partition table.

  • is_true_key (bool, optional) – MicroStrategy requires each table to have a primary key, which is a unique value identifying each distinct data record or row. A primary key can be defined by one or more columns in the table. MicroStrategy determines the primary key for a table based on the attribute’s mapped to the columns of the table. The key is made up of the lowest level attributes. If these columns are mapped to attributes in MicroStrategy, then the primary key is represented correctly. In this case, if isTrueKey is returned as true, it indicates specified primary key is the true key.

  • enclose_sql_in_parentheses (bool, optional) – This property is only applied to free form sql table. This encloses the entire SQL that you typed in the sqlStatement field in parentheses when the SQL statement is executed.

  • check_secondary_data_source_table (bool, optional) –

    API finds compatible tables in the project. If a compatible table is found, the compatible table object information is returned. If no table is found, a new table is created. Available values: ‘true’, ‘false’

    If ‘true’, finds compatible tables in the project.

    If a compatible table is found, the compatible table object information is returned. If no table is found, a new table is created.

    If ‘false’, a new table is created.

  • column_merge_option (enum, optional) –

    Defines a column merge option Available values: ‘reuse_any’, ‘reuse_compatible_data_type’, ‘reuse_matched_data_type’. If ‘TableColumnMergeOption.REUSE_ANY’, updates the column

    data type to use the most recent column definition.

    If ‘TableColumnMergeOption.REUSE_COMPATIBLE_DATA_TYPE’, updates

    the column data type to use the data type with the largest precision or scale.

    If ‘TableColumnMergeOption.REUSE_MATCHED_DATA_TYPE’, renames

    the column in newly added table to allow it to have different data types.

  • table_prefix_option (enum, optional) –

    Define the table prefix Available values: ‘ADD_DEFAULT_PREFIX’, ‘ADD_NAMESPACE’. If ‘TablePrefixOption.ADD_DEFAULT_PREFIX’, applies the default

    prefix setting on warehouse catalog.

    If ‘TablePrefixOption.ADD_NAMESPACE’, create a prefix same

    with namespace.

Returns:

LogicalTable object

Examples

>>> LogicalTable.create(connection,
                        physical_table=PhysicalTable(
                            connection=connection,
                            id="8D67911E11D3E4981000E787EC6DE8A4",
                        ),
                        primary_data_source=SchemaObjectReference(
                            object_id="A23BBC514D336D5B4FCE919FA3",
                            sub_type=ObjectSubType.DB_ROLE
                        ),
                        )
>>> LogicalTable.create(connection,
        physical_table_name="lu_prescriber",
        physical_table_namespace="public",
        primary_data_source=SchemaObjectReference(
                object_id="DAD6CAD6457DAF29E34463961688EA60",
                sub_type=ObjectSubType.DB_ROLE),
        table_name="New Table", table_description="New Description",
        sub_type=ObjectSubType.LOGICAL_TABLE))
classmethod create_alias(connection: Connection, id: str) type[mstrio.modeling.schema.table.logical_table.LogicalTable]

Create a new table alias in a specific project.

Parameters:
  • connection (object) – MicroStrategy connection object returned by connection.Connection().

  • id (str) – Physical table id

Returns:

LogicalTable object

Examples

>>> LogicalTable.create_alias(connection,
                              id="E278D17342991E49710D6F90E2A7BF2C"
                              )
list_columns(to_dictionary: bool = False)

Lists columns of the table in a dictionary or objects form

Args: to_dictionary (bool): specifies whether to list the columns as

dictionaries or objects. Defaults to False

Returns:

A list of columns as dictionaries or objects, depending on input

update_physical_table_structure(col_merge_option: mstrio.modeling.schema.helpers.TableColumnMergeOption | str | None = None, ignore_table_prefix: bool | None = None) None
Updates a structure of a physical table upon which the logical table

depends.

Parameters:
  • col_merge_option (enum, optional) –

    Defines a column merge option Available values: ‘reuse_any’, ‘reuse_compatible_data_type’, ‘reuse_matched_data_type’. If ‘TableColumnMergeOption.REUSE_ANY’, updates the column

    data type to use the most recent column definition.

    If ‘TableColumnMergeOption.REUSE_COMPATIBLE_DATA_TYPE’,

    updates the column data type to use the data type with the largest precision or scale.

    If ‘TableColumnMergeOption.REUSE_MATCHED_DATA_TYPE’, renames

    the column in newly added table to allow it to have different data types.

    If this value is not set, use the option that set on DBRole catalog setting.

  • ignore_table_prefix (bool, optional) –

    If true, get all tables under current DB. There are three following situations:

    • If there is only one table that has same name as updated

      table, update table structure using this table.

    • If there is no table that has same name as updated table,

      throw error.

    • If there are multiple tables has same name as updated

      table, throw error.

    If false, remain the current behavior.

    If not set, get the setting value from warehouse catalog. This behavior is same as column merge options.

Examples

>>> LogicalTable(
>>>     connection, id='FF529E1446BE3DF75ECD4B8E18618747'
>>> ).update_physical_table_structure(
>>>     col_merge_option=TableColumnMergeOption.REUSE_ANY
>>> )
classmethod update_physical_table_structure_for_all_tables(connection: Connection, col_merge_option: mstrio.modeling.schema.helpers.TableColumnMergeOption | str | None = None, ignore_table_prefix: bool | None = None)
Updates structure for every table in a project mapped to a

connection.

Parameters:
  • connection (Connection) – Object representation of MSTR Connection.

  • col_merge_option (enum, optional) –

    Defines a column merge option Available values: ‘reuse_any’, ‘reuse_compatible_data_type’, ‘reuse_matched_data_type’. If ‘TableColumnMergeOption.REUSE_ANY’, updates the column

    data type to use the most recent column definition.

    If ‘TableColumnMergeOption.REUSE_COMPATIBLE_DATA_TYPE’,

    updates the column data type to use the data type with the largest precision or scale.

    If ‘TableColumnMergeOption.REUSE_MATCHED_DATA_TYPE’, renames

    the column in newly added table to allow it to have different data types.

    If this value is not set, use the option that set on DBRole catalog setting.

  • ignore_table_prefix (bool, optional) –

    If true, get all tables under current DB. There are three following situations:

    • If there is only one table that has same name as updated

      table, update table structure using this table.

    • If there is no table that has same name as updated table,

      throw error.

    • If there are multiple tables has same name as updated

      table, throw error.

    If false, remain the current behavior.

    If not set, get the setting value from warehouse catalog. This behavior is same as column merge options.

mstrio.modeling.schema.table.logical_table.list_changeset_tables(connection: Connection, project_id: str | None = None, project_name: str | None = None, limit: int | None = None, changeset_id: str | None = None, **filters) list[type[mstrio.modeling.schema.table.logical_table.LogicalTable]]
mstrio.modeling.schema.table.logical_table.list_logical_tables(connection: Connection, to_dictionary: bool = False, table_type: mstrio.modeling.schema.helpers.PhysicalTableType | None = None, name: str | None = None, folder_id: str | None = None, folder_name: str | None = None, project_id: str | None = None, project_name: str | None = None, filters: dict | None = None, limit: int | None = None) list[mstrio.modeling.schema.table.logical_table.LogicalTable] | list[dict]
List all logical tables in a project mapped to a specified connection.

Optionally, you can filter by physical table type.

Parameters:
  • connection (Connection) – Object representation of MSTR Connection.

  • name (Optional[str], optional) – Name of a table.

  • project_id (Optional[str], optional) – ID of a project. Defaults to None.

  • project_name (Optional[str], optional) – Name of a project. Defaults to None.

  • folder_id (Optional[str], optional) – ID of a folder in which to look for logical tables. Defaults to None.

  • folder_name (Optional[str], optional) – Name of a folder in which to look for logical tables. Defaults to None.

  • to_dictionary (bool, optional) – If True returns a list of dictionaries. Defaults to False.

  • table_type (PhysicalTableType, optional) – If specified, returns a list of logical tables with physical table with this type.

  • filters

    dict that specifies filter expressions. Only used if a name, folder_id, folder_name, project_id or project_name are provided. Available filters are: [‘date_created’, ‘date_modified’, ‘version_id’, ‘acg’,

    ’primary_locale’, ‘sub_type’, ‘name’, ‘id’]

  • limit – limit the number of elements returned. If None (default), all objects are returned.

Returns:

A list of LogicalTable objects

or dictionaries representing logical tables.

Return type:

list[“LogicalTable”] | list[dict]

mstrio.modeling.schema.table.physical_table module

class mstrio.modeling.schema.table.physical_table.PhysicalTable(connection: Connection, id: str, name: str | None = None, project_id: str | None = None, project_name: str | None = None)

Bases: Entity, TranslationMixin

An object representation of a metadata of physical table. A physical

table describes the metadata of a warehouse table. It contains a set of columns with a schema definition. Currently, two types of physical tables are supported. One is called a normal table. It uses the table name and namespace to fetch schema definitions from the warehouse. The other table is a freeform SQL table. It uses a SQL statement to fetch schema definitions.

information

An object that contains all of the type-neutral information stored in the metadata about an object.

columns

A list of objects representing a physical column that might appear in some data source. In addition to representing physical columns, we also use this object to represent columns that do not actually appear in any data source but which the engine should create if it needs to make a column to contain data for some higher level construct (e.g. a fact, an attribute form etc.).

namespace

The namespace in which a table resides

table_name

The name of a table

table_prefix

A table prefix of this physical table

type

A table type

sql_statement

This field applies only to a free form sql physical table

delete(force: bool = False) None
Searches for all logical table dependents based on provided physical

table_id. If they are found (i.e. physical table is included in a project) then information about dependents will be shown and prompt will be displayed. If prompt is positive, it will delete all dependent logical tables which in turn automatically removes the physical table from the project. Note, that table will be deleted only if all dependent logical tables have no dependents themselves.

Parameters:
  • connection (Connection) – Object representation of MSTR Connection.

  • table_id (str) – ID of a physical table.

  • force – (bool): If True then prompt will be skipped.

list_dependent_logical_tables() list['LogicalTable']
Searches and filters a list of logical tables based on provided

physical table_id.

Returns:

A list of LogicalTable objects that are

dependents of the specified physical table.

Return type:

list[LogicalTable]

mstrio.modeling.schema.table.physical_table.list_namespaces(connection: Connection, id: str, refresh: bool | None = None, limit: int | None = None, **filters) list[dict]

Get list of namespaces. Optionally filter them by specifying filters.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • id (str) – Datasource ID

  • refresh (bool, optional) – Force refresh

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • **filters – Available filter parameters: [‘id’, ‘name’]

Examples

>>> list_namespaces(connection, id='A23BBC514D336D5B4FCE919FE19661A3')
mstrio.modeling.schema.table.physical_table.list_physical_tables(connection: Connection, project_id: str | None = None, project_name: str | None = None, filters: dict | None = None, limit: int | None = None, to_dictionary: bool = False, include_unassigned_tables: bool = False) list[mstrio.modeling.schema.table.physical_table.PhysicalTable] | list[dict]

List all physical tables in a project.

Specify either project_id or project_name. When project_id is provided (not None), project_name is omitted.

Note

When project_id is None and project_name is None, then its value is overwritten by project_id from connection object.

Parameters:
  • connection (Connection) – Object representation of MSTR Connection.

  • project_id (Optional[str], optional) – ID of a project. Defaults to None.

  • project_name (Optional[str], optional) – Name of a project. Defaults to None.

  • limit (int, optional) – If None (default), all objects are returned.

  • to_dictionary (bool, optional) – If True returns a list of dictionaries. Defaults to False.

  • filters (dict, optional) – dict that specifies filter expressions by which objects will be filtered locally.

  • include_unassigned_tables (bool, optional) – if True also returns tables which are not assigned to any metadata object. Including those may significantly extend time required to gather data. Defaults to False.

Returns:

A list of PhysicalTable

objects or dictionaries representing physical tables.

Return type:

Union[list[“PhysicalTable”], list[dict]]

mstrio.modeling.schema.table.physical_table.list_tables_prefixes(connection: Connection, project_id: str | None = None, project_name: str | None = None)

Returns the prefixes for the physical tables

Parameters:
  • connection – Object representation of MSTR Connection

  • project_id (Optional[str], optional) – ID of a project. Defaults to None

  • project_name (Optional[str], optional) – Name of a project. Defaults to None.

Returns:

A dictionary of prefixes for all the physical tables

mstrio.modeling.schema.table.warehouse_table module

class mstrio.modeling.schema.table.warehouse_table.WarehouseTable(id: str, connection: Connection, datasource: DatasourceInstance, namespace_id: str, name: str, namespace: str)

Bases: Dictable

An object representation of a warehouse table. Depending on whether a warehouse table is included in a project, it may or may not have a persistent id and associated PhysicalTable object. When you add a warehouse table to a project, a MSTR server will create a PhysicalTable object that represents the added warehouse table and will assign it a persistent ID. You can then manipulate the table further using functionalities in mstrio.modeling.schema.table.physical_table.

connection

An object representation of MSTR Connection.

Type:

Connection

datasource

An object representation of datasource instance in which the table resides.

Type:

DatasourceInstance

name

A name of the table.

Type:

str

namespace

A name of a namespace in which the table resides.

Type:

str

namespace_id

An ID of a namespace in which the table resides.

Type:

str

physical_table_id

An ID of an associated PhysicalTable object. This attribute is set automatically after add_to_project() method was called on the table.

Type:

str

dependent_logical_tables

A list of logical tables that are mapped to the warehouse table.

Type:

Union[list[dict], list[LogicalTable]]

columns

A list of table columns.

Type:

Union[list[dict], list[TableColumn]]

add_to_project(logical_table_name: str, prefix: str | None = None, col_merge_option: mstrio.modeling.schema.helpers.TableColumnMergeOption | str | None = None) type[mstrio.modeling.schema.table.logical_table.LogicalTable]
Adds a table to a project. This function corresponds to ‘ADD WHTABLE’

statement from MSTR Command Manager.

Parameters:
  • logical_table_name (str) – Name of the logical table which will be mapped to this warehouse table.

  • prefix (Optional[str], optional) – Table prefix. Defaults to None.

  • (Optional[Union[TableColumnMergeOption (col_merge_option) – Defines a column merge option. Defaults to None.

  • str]] – Defines a column merge option. Defaults to None.

Returns:

A LogicalTable object representing a logical table

mapped to this warehouse table.

Return type:

LogicalTable

property columns
delete_from_project(force: bool = False) list[bool] | None

Remove the Warehouse Table from a project by removing all of its dependent logical tables. It will only delete dependent logical tables if they themselves have no dependent objects. This function corresponds to “REMOVE WHTABLE” statement from MSTR Command Manager.

list_columns(to_dictionary: bool = False, refresh: bool = False) list[type[mstrio.modeling.schema.helpers.TableColumn]] | list[dict]

Get columns for a specific database table.

Parameters:
  • to_dictionary (bool, optional) – If True, returns a list of dictionaries. Defaults to False.

  • refresh (bool, optional) – If True, refetches and overwrites the cached version of results stored in WarehouseTable.columns.

Returns:

A list of TableColumn objects

or dictionaries representing table columns.

Return type:

Union[list[TableColumn], list[dict]]

list_dependent_logical_tables(to_dictionary: bool = False, refresh: bool = False) list[mstrio.modeling.schema.table.logical_table.LogicalTable] | list[dict]

Get all dependent logical tables.

Parameters:
  • to_dictionary (bool, optional) – If True, returns a list of dictionaries. Defaults to False.

  • refresh (bool, optional) – If True, refreshes the result stored in self.dependent_logical_tables.

Returns:

A list of LogicalTable

objects or dictionaries representing logical tables.

Return type:

Union[list[LogicalTable], list[dict]]

mstrio.modeling.schema.table.warehouse_table.list_datasource_warehouse_tables(connection: Connection, datasource_id: str, namespace_id: str, name: str = None, refresh: bool = False, to_dictionary: bool = False, limit: int | None = None) list[type[mstrio.modeling.schema.table.warehouse_table.WarehouseTable]] | list[dict]
Lists available warehouse tables in a specified datasource within a

specified namespace.

Parameters:
  • connection (Connection) – Object representation of MSTR Connection.

  • datasource_id (str) – ID of a datasource.

  • namespace_id (str) – ID of a namespace within a given datasource_id.

  • name (str) – string by which to filter the table name

  • refresh (bool, optional) – Refresh warehouse table, default: False.

  • to_dictionary (bool, optional) – If True, the function will return list of dictionaries. Otherwise, list of WarehouseTable objects. Defaults to False.

  • limit (int, optional) – limit the number of elements returned. If None (default), all objects are returned.

Returns:

A list of WarehouseTable

or dictionary objects representing warehouse tables in a specified namespace in a specified datasource.

Return type:

Union[list[“WarehouseTable”], list[dict]]

Examples

>>> datasource_id = "DAD6CAD6457DAF29E34463961688EA60"
>>> namespace_id = "eyJucyI6InB1YmxpYyJ9"
>>> available_wh_tables = list_datasource_warehouse_tables(
    connection, datasource_id, namespace_id)
mstrio.modeling.schema.table.warehouse_table.list_warehouse_tables(connection: Connection, to_dictionary: bool = False, name: str | None = None, datasource_id: str | None = None) list[mstrio.modeling.schema.table.warehouse_table.WarehouseTable] | list[dict]
Fetches all available warehouse table. This operation is done

asynchronously and is heavy: a lot of requests are performed to fetch all connected and available datasources, namespaces and finally warehouse tables for each combination. Additionally, the result could be filtered. Available filters are table name and datasource id. These filters can be combined.

Parameters:
  • connection (Connection) – Object representation of MSTR Connection.

  • to_dictionary (bool, optional) – If True, returns a list of dictionaries. If False, returns a list of WarehouseTable objects.

  • name (str, optional) – A name of a warehouse table.

  • datasource_id (str, optional) – ID of a datasource.

Returns:

A list of dictionaries

or WarehouseTable objects.

Return type:

list[WarehouseTable] | list[dict]

Module contents