tabsdata
AzureAccountKeyCredentials | Credentials class to store the credentials needed to access an Azure using account key credentials (account name and account key). |
AzureAccountKeyCredentials.to_dict | Convert the S3AccessKeyCredentials object to a dictionary. |
AzureDestination | Class for managing the configuration of Azure-file-based data outputs. |
AzureDestination.to_dict | Converts the AzureDestination object to a dictionary with all the relevant information. |
AzureSource | Class for managing the configuration of Azure-file-based data inputs. |
AzureSource.to_dict | Converts the AzureSource object to a dictionary with all the relevant information. |
Collection | This class represents a collection in the TabsdataServer. |
Commit | This class represents a commit in the TabsdataServer. |
concat | Combine multiple TableFrames by stacking their rows. |
CSVFormat | The class of the CSV file format. |
CSVFormat.to_dict | Returns the dictionary representation of the object. |
DataVersion | This class represents a data version of a table in the TabsdataServer. |
DestinationPlugin | Abstract class for output plugins. |
DestinationPlugin.to_dict | Return a dictionary representation of the object. |
DestinationPlugin.trigger_output | Trigger the exporting of the data. |
DirectSecret | Secrets class representing a secret stored in plain text. |
DirectSecret.to_dict | Convert the DirectSecret object to a dictionary. |
EnvironmentSecret | Secrets class representing a secret obtained from an environment variable in the server. |
EnvironmentSecret.to_dict | Convert the EnvironmentSecret object to a dictionary. |
ExecutionPlan | This class represents an execution plan in the TabsdataServer. |
Expr | |
Expr.abs | Return the abso lute value of the expression. |
Expr.add | Equivalent to the + operator. |
Expr.alias | Set the name for a column or expression. |
Expr.and_ | Bitwise and operator with the given expressions. |
Expr.arccos | Calculate the inverse cosine of the element value. |
Expr.arccosh | Calculate the inverse hyperbolic cosine of the element value. |
Expr.arcsin | Calculate the inverse sine of the element value. |
Expr.arcsinh | Calculate the inverse hyperbolic sine of the element value. |
Expr.arctan | Calculate the inverse tangent of the element value. |
Expr.arctanh | Calculate the inverse hyperbolic tangent of the element value. |
Expr.cast | Cast a value to d different type. |
Expr.cbrt | Calculate the cub root of the element value. |
Expr.ceil | Round up the expression to the next integer value. |
Expr.clip | For element values outside the lower and upper bounds, lower values are replaced with the lower bound and upper values with the upper bound. |
Expr.cos | Calculate the cosine of the element value. |
Expr.cosh | Calculate the hyperbolic cosine of the element value. |
Expr.cot | Calculate the cotangent of the element value. |
Expr.count | Aggregation operation that counts the non null values of the given column in the group. |
Expr.degrees | Convert a radian value to degrees |
Expr.diff | Compute the difference between an element value and the element value of the specified relative row. |
Expr.eq | Compare if 2 expressions are equal, equivalent to expr == other. |
Expr.eq_missing | Compare if 2 expressions are equal an, equivalent to expr == other. |
Expr.exp | Calculate the exponential of the element value. |
Expr.fill_nan | Replace NaN values with the given value. |
Expr.fill_null | Replace null values with the given value. |
Expr.filter | Apply a filter predicate to an expression. |
Expr.first | Get the first element. |
Expr.floor | Round down the expression to the previous integer value. |
Expr.floordiv | Calculate the floor on the division. |
Expr.ge | Greater or equal operator. |
Expr.gt | Greater than operator. |
Expr.hash | Compute the hash of an element value. |
Expr.is_between | If an expression is between the given bounds. |
Expr.is_finite | If an element value is finite. |
Expr.is_in | If an element value is in the given collection. |
Expr.is_infinite | If an element value is infinite. |
Expr.is_nan | If an element value is NaN. |
Expr.is_not_nan | If an element value is not NaN. |
Expr.is_not_null | If an element value is not null (None). |
Expr.is_null | If an element value is null (None). |
Expr.is_unique | If an element value is unique for all values in the column. |
Expr.last | Get the last element. |
Expr.le | Less or equal operator. |
Expr.len | Aggregation operation that counts the rows in the group. |
Expr.log | Calculate the logarithm to the given base. |
Expr.log10 | Calculate the logarithm base 10. |
Expr.log1p | Calculate the natural logarithm plus one. |
Expr.lt | Less than operator. |
Expr.max | Aggregation operation that finds the maximum value in the group. |
Expr.mean | Aggregation operation that finds the mean of the values in the group. |
Expr.median | Aggregation operation that finds the median of the values in the group. |
Expr.min | Aggregation operation that finds the minimum value in the group. |
Expr.mod | Modulus operator. |
Expr.mul | Multiplication operator. |
Expr.n_unique | Aggregation operation that counts the unique values of the given column in the group. |
Expr.ne | Compare if 2 expressions are not equal, equivalent to expr != other. |
Expr.ne_missing | Compare if 2 expressions are not equal an, equivalent to expr != other. |
Expr.neg | Unary minus operator. |
Expr.not_ | Negate a boolean expression. |
Expr.or_ | Bitwise or operator with the given expressions. |
Expr.pow | Exponentiation operator. |
Expr.radians | Convert a degree value to radians |
Expr.rank | Compute the rank of the element values. |
Expr.reinterpret | Reinterpret the 64bit element values (i64 or u64) as a signed/unsigned integers. |
Expr.round | Round floating point element values. |
Expr.round_sig_figs | Round floating point element values to the specified significant figures. |
Expr.shrink_dtype | Cast down a column to the smallest type that can hold the element values. |
Expr.sign | Calculate the sign of element values. |
Expr.sin | Calculate the sine of the element value. |
Expr.sinh | Calculate the hyperbolic sine of the element value. |
Expr.slice | Compute a slice of the TableFrame for the specified columns. |
Expr.sqrt | Calculate the square root of the element value. |
Expr.sub | Equivalent to the - operator. |
Expr.sum | Aggregation operation that sums the values in the group. |
Expr.tan | Calculate the tangent of the element value. |
Expr.tanh | Calculate the hyperbolic tangent of the element value. |
Expr.truediv | Equivalent to the float / operator. |
Expr.xor | Bitwise xor operator with the given expression. |
HashiCorpSecret | Secrets class representing a secret stored in Hashicorp Vault. |
HashiCorpSecret.to_dict | Convert the HashiCorpSecret object to a dictionary. |
lit | Expression for the given literal value. |
LocalFileDestination | Abstract base class for managing data output configurations. |
LocalFileDestination.to_dict | Converts the LocalFileDestination object to a dictionary with all the relevant information. |
LocalFileSource | Class for managing the configuration of local-file-based data inputs. |
LocalFileSource.to_dict | Converts the LocalFileSource object to a dictionary with all the relevant information. |
LogFormat | The class of the log file format. |
LogFormat.to_dict | Returns the dictionary representation of the object. |
MariaDBDestination | Class for managing the configuration of MariaDB-based data outputs. |
MariaDBDestination.to_dict | Converts the MariaDBDestination object to a dictionary with all the relevant information. |
MariaDBSource | Class for managing the configuration of MariaDB-based data inputs. |
MariaDBSource.to_dict | Converts the MariaDBSource object to a dictionary with all the relevant information. |
MySQLDestination | Class for managing the configuration of MySQL-based data outputs. |
MySQLDestination.to_dict | Converts the MySQLDestination object to a dictionary with all the relevant information. |
MySQLSource | Class for managing the configuration of MySQL-based data inputs. |
MySQLSource.to_dict | Converts the MySQLSource object to a dictionary with all the relevant information. |
NDJSONFormat | The class of the log file format. |
NDJSONFormat.to_dict | Returns the dictionary representation of the object. |
OracleDestination | Class for managing the configuration of Oracle-based data outputs. |
OracleDestination.to_dict | Converts the OracleDestination object to a dictionary with all the relevant information. |
OracleSource | Class for managing the configuration of Oracle-based data inputs. |
OracleSource.to_dict | Converts the OracleSource object to a dictionary with all the relevant information. |
ParquetFormat | The class of the Parquet file format. |
ParquetFormat.to_dict | Returns the dictionary representation of the object. |
PostgresDestination | Class for managing the configuration of Postgres-based data outputs. |
PostgresDestination.to_dict | Converts the PostgresDestination object to a dictionary with all the relevant information. |
PostgresSource | Class for managing the configuration of Postgres-based data inputs. |
PostgresSource.to_dict | Converts the PostgresSource object to a dictionary with all the relevant information. |
publisher | Decorator to set the data and destination parameters of a function and convert it to a TabsdataFunction. |
S3AccessKeyCredentials | Credentials class to store the credentials needed to access an S3 bucket using access key credentials (access key id and secret access key). |
S3AccessKeyCredentials.to_dict | Convert the S3AccessKeyCredentials object to a dictionary. |
S3Destination | Class for managing the configuration of S3-file-based data outputs. |
S3Destination.to_dict | Converts the S3Destination object to a dictionary with all the relevant information. |
S3Source | Class for managing the configuration of S3-file-based data inputs. |
S3Source.to_dict | Converts the S3Source object to a dictionary with all the relevant information. |
SourcePlugin | Abstract class for input plugins. |
SourcePlugin.to_dict | Return a dictionary representation of the object. |
SourcePlugin.trigger_input | Trigger the import of the data. |
subscriber | Decorator to set the data and destination parameters of a function and convert it to a TabsdataFunction. |
TableFrame | Owned Functions. |
TableFrame.cast | Cast columns to a new data type. |
TableFrame.clear | Clears all rows of the TableFrame preserving the schema. |
TableFrame.drop | Discard columns from the TableFrame. |
TableFrame.drop_nans | Drop rows with NaN values. |
TableFrame.drop_nulls | Drop rows with null values. |
TableFrame.empty | |
TableFrame.fill_nan | Replace all NaN values in the TableFrame with the given value. |
TableFrame.fill_null | Replace all null values in the TableFrame with the given value. |
TableFrame.filter | Filter the TableFrame based on the given predicates. |
TableFrame.first | Return a TableFrame with the first row. |
TableFrame.group_by | Perform a group by on the TableFrame. |
TableFrame.head | Return a TableFrame with the first n rows. |
TableFrame.item | |
TableFrame.join | Join the TableFrame with another TableFrame. |
TableFrame.last | Return a TableFrame with the last row. |
TableFrame.limit | Return a TableFrame with the first n rows. |
TableFrame.select | Select column(s) from the TableFrame. |
TableFrame.slice | Return a TableFrame with a slice of the original TableFrame |
TableFrame.sort | Sort the TableFrame by the given column(s) or expression(s). |
TableFrame.tail | Return a TableFrame with the last n rows. |
TableFrame.unique | Deduplicate rows from the TableFrame. |
TableFrame.with_columns | Add columns to the TableFrame. |
TableInput | Class for managing the configuration of table-based data inputs. |
TableInput.to_dict | Converts the TableInput object to a dictionary with all the relevant information. |
TableOutput | Class for managing the configuration of table-based data outputs. |
TableOutput.to_dict | Converts the TableOutput object to a dictionary with all the relevant information. |
TableURI | URI class to represent a Tabs Data URI. |
TableURI.to_string | Return the URI as a string. |
TabsdataFunction | Class to decorate a function with metadata and methods for use in a Tabsdata environment. |
TabsdataServer | This class represents the TabsdataServer. |
TabsdataServer.collection_create | Create a collection in the server. |
TabsdataServer.collection_delete | Delete a collection in the server. |
TabsdataServer.collection_get | Get a collection in the server. |
TabsdataServer.collection_list_functions | List the functions in a collection. |
TabsdataServer.collection_update | Update a collection in the server. |
TabsdataServer.dataversion_list | List the data versions of a function in a collection. |
TabsdataServer.execution_plan_read | Read the execution plan in the server. |
TabsdataServer.function_create | Create a function in the server. |
TabsdataServer.function_delete | Delete a function in the server. |
TabsdataServer.function_get | Get a function in the server. |
TabsdataServer.function_list_history | List the version history of a function. |
TabsdataServer.function_trigger | Trigger a function in the server. |
TabsdataServer.function_update | Update a function in the server. |
TabsdataServer.table_download | Download a table for a given version as a parquet file. |
TabsdataServer.table_get_schema | Get the schema of a table for a given version. |
TabsdataServer.table_list | List the tables in a collection. |
TabsdataServer.table_sample | Get a sample of a table for a given version as a parquet file. |
TabsdataServer.transaction_cancel | Cancel an execution plan. |
TabsdataServer.transaction_recover | Recover an execution plan. |
TabsdataServer.user_create | Create a user in the server. |
TabsdataServer.user_delete | Delete a user in the server. |
TabsdataServer.user_get | Get a user in the server. |
TabsdataServer.user_update | Update a user in the server. |
TabsdataServer.worker_list | |
TabsdataServer.worker_log | Get the logs of a worker in the server. |
transformer | Decorator to set the data and destination parameters of a function and convert it to a TabsdataFunction. |
User | This class represents a user in the TabsdataServer. |
UserPasswordCredentials | Credentials class to store a user and password pair. |
UserPasswordCredentials.to_dict | Convert the UserPasswordCredentials object to a dictionary. |
Collection
class Collection(
name: str,
description: str,
created_on: int,
created_by: str,
**kwargs,
)
This class represents a collection in the TabsdataServer.
Parameters:
Attributescreated_on_string (str): The timestamp when the collection was created as a string.
Initialize the Collection object.
Parameters:
namestrThe name of the collection.
descriptionstrThe description of the collection.
created_onintThe timestamp when the collection was created.
created_bystrThe user that created the collection.
**kwargsAdditional keyword arguments.
Commit
class Commit(
id: str,
execution_plan_id: str,
transaction_id: str,
triggered_on: int,
ended_on: int,
started_on: int,
**kwargs,
)
This class represents a commit in the TabsdataServer.
Parameters:
Attributestriggered_on_str (str): The timestamp when the commit was triggered as a string. ended_on_str (str): The timestamp when the commit ended as a string. started_on_str (str): The timestamp when the commit started as a string.
DataVersion
class DataVersion(
id: str,
execution_plan_id: str,
triggered_on: int,
status: str,
function_id: str,
**kwargs,
)
This class represents a data version of a table in the TabsdataServer.
Parameters:
idstrThe ID of the data version.
execution_plan_idstrThe ID of the execution plan.
triggered_onintThe timestamp when the data version was triggered.
statusstrThe status of the data version.
function_idstrThe ID of the function.
**kwargsAdditional keyword arguments.
Initialize the DataVersion object.
Parameters:
idstrThe ID of the data version.
execution_plan_idstrThe ID of the execution plan.
triggered_onintThe timestamp when the data version was triggered.
statusstrThe status of the data version.
function_idstrThe ID of the function.
**kwargsAdditional keyword arguments.
DirectSecret
class DirectSecret(secret_direct_value: str)
Bases: Secret
Secrets class representing a secret stored in plain text.
Attributes: secret_direct_value (str): The secret value.
Methods: to_dict() -> dict: Convert the DirectSecret object to a dictionary. secret_value() -> str: Get the secret value.
Initialize the DirectSecret object.
Parameters:
secret_direct_valuestrThe secret value.
secret_valuestrGet the secret value pointed at by the secret. To be used only during execution in the backend.
Returns: str: The secret value.
to_dictdef to_dict() -> dict
Convert the DirectSecret object to a dictionary.
Returns:
dict: A dictionary representation of the DirectSecret object.
ExecutionPlan
class ExecutionPlan(
id: str,
name: str,
collection: str,
dataset: str,
triggered_by: str,
triggered_on: int,
ended_on: int,
started_on: int,
status: str,
**kwargs,
)
This class represents an execution plan in the TabsdataServer.
Parameters:
Attributestriggered_on_str (str): The timestamp when the execution plan was triggered as a string. ended_on_str (str): The timestamp when the execution plan ended as a string. started_on_str (str): The timestamp when the execution plan started as a string.
Initialize the ExecutionPlan object.
Parameters:
idstrThe id of the execution plan.
namestrThe name of the execution plan.
collectionstrThe collection where the execution plan is running.
datasetstrThe dataset where the execution plan is running.
triggered_bystrThe user that triggered the execution plan.
triggered_onintThe timestamp when the execution plan was triggered.
ended_onintThe timestamp when the execution plan ended.
started_onintThe timestamp when the execution plan started.
statusstrThe status of the execution plan.
**kwargsAdditional keyword arguments.
Expr
class Expr(expr: Expr | Expr)
dtExprDateTimeNameSpaceReturn an object namespace with all date-time methods for a date-time value.
strExprStringNameSpaceReturn an object namespace with all string methods for a string value.
abs()add()alias()and_()arccos()arccosh()arcsin()arcsinh()arctan()arctanh()cast()cbrt()ceil()clip()cos()cosh()cot()count()degrees()diff()eq()eq_missing()exp()fill_nan()fill_null()filter()first()floor()ge()gt()hash()is_between()is_finite()is_in()is_infinite()is_nan()is_not_nan()is_not_null()is_null()is_unique()last()le()len()log()log10()log1p()lt()max()mean()median()min()mod()mul()n_unique()ne()ne_missing()neg()not_()or_()pow()radians()rank()reinterpret()round()round_sig_figs()shrink_dtype()sign()sin()sinh()slice()sqrt()sub()sum()tan()tanh()truediv()xor()
floordivdef floordiv(other: Any) -> Expr
Calculate the floor on the division.
Parameters:
otherThe value to divide by.
Example:
>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf = tf.select(td.col("temp"), td.col("temp").floordiv(2)
>>> .alias("floordiv"))
>>>
┌──────┬──────────┐
│ temp ┆ floordiv │
│ --- ┆ ------- │
│ f64 ┆ i64 │
╞══════╪══════════╡
│ 2.5 ┆ 1 │
│ 1.4 ┆ 0 │
└──────┴──────────┘
TableURI
class TableURI(
collection: str | None = None,
table: str = None,
version: str | Version | VersionList | VersionRange | None = None,
)
URI class to represent a Tabs Data URI. The URI is composed of a collection, a table and a version. The URI is represented as collection/table@version or table@version. The collection and table are optional, but at least one of them must be present. The version is optional. The collection and table must be strings. The version can be a string, a Version object, a VersionList object or a VersionRange object.
Attributes: collection (str): The collection of the URI. table (str): The table of the URI. version (Version | VersionList | VersionRange | None): The version of the URI.
Methods: to_string() -> str: Return the URI as a string.
Initialize the URI object.
Parameters:
collectionstr | NoneThe collection of the URI.
tablestr | NoneThe table of the URI.
versionstr | Version | VersionList | VersionRange | NoneThe version of the URI. If it is a string, it can be a single version, a list of versions separated by commas or a range of versions separated by two dots. If it is a Version, VersionList or VersionRange object, it will be used as is.
collectionstrThe collection of the URI.
tablestrThe table of the URI.
versionVersion | VersionList | VersionRange | NoneThe version(s) of the URI.
to_stringdef to_string() -> str
Return the URI as a string.
Returns:
str: The URI as a string.
TabsdataServer
class TabsdataServer(url: str, username: str, password: str)
This class represents the TabsdataServer.
Parameters:
urlstrThe url of the server.
usernamestrThe username of the user.
passwordstrThe password of the user.
Initialize the TabsdataServer object.
Parameters:
urlstrThe url of the server.
usernamestrThe username of the user.
passwordstrThe password of the user.
collectionsList[Collection]Get the list of collections in the server. This list is obtained every time the property is accessed, so sequential accesses to this property in the same object might yield different results.
Returns: List[Collection]: The list of collections in the server.
commitsList[Commit]Get the list of commits in the server. This list is obtained every time the property is accessed, so sequential accesses to this property in the same object might yield different results.
Returns: List[Transaction]: The list of commits in the server.
execution_plansList[ExecutionPlan]Get the list of execution plans in the server. This list is obtained every time the property is accessed, so sequential accesses to this property in the same object might yield different results.
Returns: List[ExecutionPlan]: The list of execution plans in the server.
statusServerStatusGet the status of the server. This status is obtained every time the property is accessed, so sequential accesses to this property in the same object might yield different results.
Returns: ServerStatus: The status of the server.
transactionsList[Transaction]Get the list of transactions in the server. This list is obtained every time the property is accessed, so sequential accesses to this property in the same object might yield different results.
Returns: List[Transaction]: The list of transactions in the server.
usersList[User]Get the list of users in the server. This list is obtained every time the property is accessed, so sequential accesses to this property in the same object might yield different results.
Returns: List[User]: The list of users in the server.
collection_createdef collection_create(name: str, description: str = None, raise_for_status: bool = True)
Create a collection in the server.
Parameters:
namestrThe name of the collection.
descriptionstr, optionalThe description of the collection.
raise_for_statusbool, optionalWhether to raise an exception if the request was not successful. Defaults to True.
Raises:
APIServerError: If the collection could not be created.
collection_deletedef collection_delete(name: str, raise_for_status: bool = True)
Delete a collection in the server.
Parameters:
namestrThe name of the collection.
raise_for_statusbool, optionalWhether to raise an exception if the request was not successful. Defaults to True.
Raises:
APIServerError: If the collection could not be deleted.
collection_getdef collection_get(name: str) -> Collection
Get a collection in the server.
Parameters:
namestrThe name of the collection.
Returns:
Collection: The collection.
Raises:
APIServerError: If the collection could not be obtained.
collection_list_functionsdef collection_list_functions(collection_name) -> List[Function]
List the functions in a collection.
Parameters:
collection_namestrThe name of the collection.
Returns:
List[Function]: The list of functions in the collection.
Raises:
APIServerError: If the functions could not be listed.
collection_updatedef collection_update(
name: str,
new_name = None,
new_description: str = None,
raise_for_status: bool = True,
)
Update a collection in the server.
Parameters:
namestrThe name of the collection.
new_namestr, optionalThe new name of the collection.
new_descriptionstr, optionalThe new description of the collection.
raise_for_statusbool, optionalWhether to raise an exception if the request was not successful. Defaults to True.
Raises:
APIServerError: If the collection could not be updated.
dataversion_listdef dataversion_list(
collection_name: str,
function_name: str,
offset: int = None,
len: int = None,
) -> List[DataVersion]
List the data versions of a function in a collection.
Parameters:
collection_namestrThe name of the collection.
function_namestrThe name of the function.
offsetint, optionalThe offset of the data versions to list.
lenint, optionalThe number of data versions to list.
Returns:
List[DataVersion]: The list of data versions of the function.
Raises:
APIServerError: If the data versions could not be listed.
execution_plan_readdef execution_plan_read(execution_plan_id: str) -> str
Read the execution plan in the server.
Parameters:
execution_plan_idstrThe ID of the execution plan.
Returns:
str: The execution plan.
function_createdef function_create(
collection_name: str,
function_path: str,
description: str = None,
path_to_bundle: str = None,
requirements: str = None,
local_packages: str | List[str] | NoneType = None,
raise_for_status: bool = True,
)
Create a function in the server.
Parameters:
collection_namestrThe name of the collection.
function_pathstrThe path to the function. It should be in the form of /path/to/file.py::function_name.
descriptionstr, optionalThe description of the function.
path_to_bundlestr, optionalThe path that has to be bundled and sent to the server. If None, the folder containing the function will be bundled.
requirementsstr, optionalPath to a custom requirements.yaml file with the packages, python version and other information needed to create the Python environment for the function to run in the backend. If not provided, this information will be inferred from the current execution session.
local_packagesList[str] | str, optionalA list of paths to local Python packages that need to be included in the bundle. Each path must exist and be a valid Python package that can be installed by running pip install /path/to/package.
raise_for_statusbool, optionalWhether to raise an exception if the request was not successful. Defaults to True.
Raises:
APIServerError: If the function could not be created.
function_deletedef function_delete(collection_name, function_name, raise_for_status: bool = True)
Delete a function in the server.
Parameters:
collection_namestrThe name of the collection.
function_namestrThe name of the function.
raise_for_statusbool, optionalWhether to raise an exception if the request was not successful. Defaults to True.
Raises:
APIServerError: If the function could not be deleted.
function_getdef function_get(collection_name, function_name) -> Function
Get a function in the server.
Parameters:
collection_namestrThe name of the collection.
function_namestrThe name of the function.
Returns:
Function: The function.
Raises:
APIServerError: If the function could not be obtained.
function_list_historydef function_list_history(collection_name, function_name) -> List[Function]
List the version history of a function.
Parameters:
collection_namestrThe name of the collection.
function_namestrThe name of the function.
Returns:
List[Function]: The list of versions of the function.
Raises:
APIServerError: If the data could not be listed.
function_triggerdef function_trigger(
collection_name,
function_name,
execution_plan_name: str | None = None,
raise_for_status: bool = True,
) -> Response
Trigger a function in the server.
Parameters:
collection_namestrThe name of the collection.
function_namestrThe name of the function.
execution_plan_namestr, optionalThe name of the execution plan.
raise_for_statusbool, optionalWhether to raise an exception if the request was not successful. Defaults to True.
Returns:
requests.Response: The response of the trigger request.
Raises:
APIServerError: If the function could not be triggered.
function_updatedef function_update(
collection_name: str,
function_name: str,
function_path: str,
description: str,
directory_to_bundle: str = None,
requirements: str = None,
local_packages: str | List[str] | NoneType = None,
raise_for_status: bool = True,
)
Update a function in the server.
Parameters:
collection_namestrThe name of the collection.
function_namestrThe name of the function.
function_pathstrThe path to the function. It should be in the form of /path/to/file.py::function_name.
descriptionstrThe new description of the function.
directory_to_bundlestr, optionalThe path that has to be bundled and sent to the server. If None, the folder containing the function will be bundled.
requirementsstr, optionalPath to a custom requirements.yaml file with the packages, python version and other information needed to create the Python environment for the function to run in the backend. If not provided, this information will be inferred from the current execution session.
local_packagesList[str] | str, optionalA list of paths to local Python packages that need to be included in the bundle. Each path must exist and be a valid Python package that can be installed by running pip install /path/to/package.
raise_for_statusbool, optionalWhether to raise an exception if the request was not successful. Defaults to True.
Raises:
APIServerError: If the function could not be updated.
table_downloaddef table_download(
collection_name: str,
table_name: str,
destination_file: str,
commit: str = None,
time: str = None,
version: str = None,
raise_for_status: bool = True,
)
Download a table for a given version as a parquet file. The version can be a fixed version or a relative one (HEAD, HEAD^, and HEAD~## syntax).
Parameters:
collection_namestrThe name of the collection.
table_namestrThe name of the table.
destination_filestrThe path to the destination file.
commitstr, optionalThe commit ID of the table to be downloaded.
timestr, optionalIf provided, the table version that was published last before that time will be downloaded.
versionstr, optionalThe version of the table to be downloaded. The version can be a fixed version or a relative one (HEAD, HEAD^, and HEAD~## syntax). Defaults to "HEAD".
raise_for_statusbool, optionalWhether to raise an exception if the request was not successful. Defaults to True.
Raises:
APIServerError: If the schema could not be obtained.
table_get_schemadef table_get_schema(
collection_name: str,
table_name: str,
commit: str = None,
time: str = None,
version: str = None,
) -> dict
Get the schema of a table for a given version. The version can be a fixed version or a relative one (HEAD, HEAD^, and HEAD~## syntax).
Parameters:
collection_namestrThe name of the collection.
table_namestrThe name of the table.
commitstr, optionalThe commit ID of the table from which we will obtain the schema.
timestr, optionalIf provided, the table version that was published last before that time will be the one queried for its schema.
versionstr, optionalThe version of the table to be queried for its schema. The version can be a fixed version or a relative one (HEAD, HEAD^, and HEAD~## syntax). Defaults to "HEAD".
Returns:
dict: The schema of the table.
Raises:
APIServerError: If the schema could not be obtained.
table_listdef table_list(collection_name: str, offset: int = None, len: int = None) -> List[Table]
List the tables in a collection.
Parameters:
collection_namestrThe name of the collection.
offsetint, optionalThe offset of the list.
lenint, optionalThe length of the list.
Returns:
List[Table]: The requested list of tables in the collection.
table_sampledef table_sample(
collection_name: str,
table_name: str,
commit: str = None,
time: str = None,
version: str = None,
offset: int = None,
len: int = None,
) -> DataFrame
Get a sample of a table for a given version as a parquet file. The version can be a fixed version or a relative one (HEAD, HEAD^, and HEAD~## syntax).
Parameters:
collection_namestrThe name of the collection.
table_namestrThe name of the table.
commitstr, optionalThe commit ID of the table from which we will obtain the sample.
timestr, optionalIf provided, the table version that was published last before that time will be the one queried for a sample.
versionstr, optionalThe version of the table to be queried for a sample. The version can be a fixed version or a relative one (HEAD, HEAD^, and HEAD~## syntax). Defaults to "HEAD".
offsetint, optionalThe offset of the sample.
lenint, optionalThe length of the sample.
Raises:
APIServerError: If the schema could not be obtained.
transaction_canceldef transaction_cancel(execution_plan_id: str) -> Response
Cancel an execution plan. This includes all functions that are part of the execution plan and all its dependants.
Parameters:
execution_plan_idstrThe ID of the execution plan to cancel.
Returns:
requests.Response: The response of the server to the request.
Raises:
APIServerError: If the execution_plan_id is not found in the system.
transaction_recoverdef transaction_recover(execution_plan_id: str) -> Response
Recover an execution plan. This includes all functions that are part of the execution plan and all its dependants.
Parameters:
execution_plan_idstrThe ID of the execution plan to recover.
Returns:
requests.Response: The response of the server to the request.
Raises:
APIServerError: If the execution_plan_id is not found in the system.
user_createdef user_create(
name: str,
password: str,
full_name: str = None,
email: str = None,
enabled: bool = True,
raise_for_status: bool = True,
)
Create a user in the server.
Parameters:
namestrThe name of the user.
passwordstrThe password of the user.
full_namestr, optionalThe full name of the user.
emailstr, optionalThe email of the user.
enabledbool, optionalWhether the user is enabled or not.
raise_for_statusbool, optionalWhether to raise an exception if the request was not successful. Defaults to True.
Raises:
APIServerError: If the user could not be created.
user_deletedef user_delete(name: str, raise_for_status: bool = True)
Delete a user in the server.
Parameters:
namestrThe name of the user.
raise_for_statusbool, optionalWhether to raise an exception if the request was not successful. Defaults to True.
Raises:
APIServerError: If the user could not be deleted.
user_getdef user_get(name: str) -> User
Get a user in the server.
Parameters:
namestrThe name of the user.
Returns:
User: The user.
Raises:
APIServerError: If the user could not be obtained.
user_updatedef user_update(
name: str,
full_name: str = None,
email: str = None,
enabled: bool = None,
raise_for_status: bool = True,
)
Update a user in the server.
Parameters:
namestrThe name of the user.
full_namestr, optionalThe full name of the user.
emailstr, optionalThe email of the user.
enabledbool, optionalWhether the user is enabled or not.
raise_for_statusbool, optionalWhether to raise an exception if the request was not successful. Defaults to True.
Raises:
APIServerError: If the user could not be updated.
worker_listdef worker_list(
by_function_id: str = None,
by_transaction_id: str = None,
by_execution_plan_id: str = None,
by_data_version_id: str = None,
)
worker_logdef worker_log(worker_id: str) -> str
Get the logs of a worker in the server.
Parameters:
worker_idstrThe ID of the worker.
Returns:
str: The worker logs.
User
class User(name: str, full_name: str, email: str, enabled: bool, **kwargs)
This class represents a user in the TabsdataServer.
Parameters:
namestrThe name of the user.
full_namestrThe full name of the user.
emailstrThe email of the user.
enabledboolWhether the user is enabled or not.
**kwargsAdditional keyword arguments.
Initialize the User object.
Parameters:
namestrThe name of the user.
full_namestrThe full name of the user.
emailstrThe email of the user.
enabledboolWhether the user is enabled or not.
**kwargsAdditional keyword arguments.