Dataset APIs
columns
Description: Retrieves a collection of all column names in a dataset.
Syntax:
columns()
Input parameters: None.
Return type: tuple[str, ...].
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*',
... secret_key='*'
...
...
... )
>>> ds = con.load_dataset("demo_table_10", database='my_schema')
>>> ds.columns
('species',
'island',
'bill_length_mm',
'bill_depth_mm', 'flipper_length_mm') add_column
Description: Adds columns to a dataset.
Syntax:
add_column(*exprs, **mutations)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| exprs | No | Union[Sequence[Expr], None] | Sequence of named expressions to be added as columns. |
| mutations | No | Value | Named expressions passed as keyword arguments. |
Return type: Updated dataset with new columns.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_6", database='my_schema')
>>> ds
| species | bill_length_mm |
| ------- | -------------- |
| string | float64 |
| ------- | -------------- |
| Adelie | 40.0 |
| Adelie | 41.0 |
| Adelie | 42.0 |
| Adelie | 43.0 |
#Add a new column from a per-element expression
>>> ds.add_column(new_col=ds.bill_length_mm + 1)
| species | bill_length_mm | new_col |
| ------- | -------------- | -------- |
| string | float64 | float64 |
| ------- | -------------- | -------- |
| Adelie | 40.0 | 41.0 |
| Adelie | 41.0 | 42.0 |
| Adelie | 42.0 | 43.0 |
| Adelie | 43.0 | 44.0 | drop_columns
Description: Removes columns from a dataset.
Syntax:
drop_columns(*fields)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| fields | Yes | str | Name of the column to be removed. |
Return type: Updated dataset after removing the columns.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_12", database='my_schema')
>>> ds
| species | island | bill_length_mm | bill_depth_mm | flipper_length_mm |
| ------- | --------- | -------------- | ------------- | ----------------- |
| string | string | float64 | float64 | int64 |
| ------- | --------- | -------------- | ------------- | ----------------- |
| Adelie | Torgersen | 40.0 | 22.0 | 180 |
| Adelie | Torgersen | 41.0 | 19.0 | 183 |
| Adelie | Torgersen | 42.0 | 20.0 | 190 |
| Adelie | Torgersen | 43.0 | 23.0 | 185 |
# Drop one or more columns
>>> ds.drop_columns("species")
| island | bill_length_mm | bill_depth_mm | flipper_length_mm |
| --------- | -------------- | ------------- | ----------------- |
| string | float64 | float64 | int64 |
| --------- | -------------- | ------------- | ----------------- |
| Torgersen | 40.0 | 22.0 | 180 |
| Torgersen | 41.0 | 19.0 | 183 |
| Torgersen | 42.0 | 20.0 | 190 |
| Torgersen | 43.0 | 23.0 | 185 | aggregate
Description: Aggregates the dataset using specified grouping fields and aggregation functions.
Syntax:
aggregate(metrics=(), /, *, by=(), having=(), **kwargs)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| metrics | No | Union[Sequence[AggregateFnBuilder], None] | Aggregation expressions, which can be any expressions that generate scalar values, including aggregate functions such as sum. |
| by | No | Union[Sequence[Value], None] | Grouping expressions, typically a collection of column names from a dataset. |
| having | No | Union[Sequence[BooleanValue], None] | Post-aggregation filter. Its data dimensions must match those of metrics, and its output type must be boolean. |
| kwargs | No | - | Named aggregation expressions. |
Return type: Aggregated dataset.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_13", database='my_schema')
>>> ds
| fruit | price |
| ------ | ----- |
| apple | 0.50 |
| apple | 0.50 |
| banana | 0.25 |
| orange | 0.33 |
>>> ds.aggregate(
... by=["fruit"],
... total_cost=ds.price.sum(),
... avg_cost=ds.price.mean(),
... having=ds.price.sum() < 0.5,
... ).order_by("fruit")
| fruit | total_cost | avg_cost |
| ------ | ---------- | -------- |
| string | float64 | float64 |
| ------ | ---------- | -------- |
| banana | 0.25 | 0.25 |
| orange | 0.33 | 0.33 | count
Description: Calculates the total number of rows in a dataset.
Syntax:
count()
Input parameters: None.
Return type: int.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_11", database='my_schema')
>>> ds
| a |
| ----- |
| string|
| ----- |
| foo |
| bar |
| baz |
>>> ds.count()
┌─┐
│ 3│
└─┘ execute
Description: Executes expressions.
Syntax:
execute(*, limit='default', params=None, block=False, **kwargs)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| limit | No | Union[int, str, None] | The maximum number of rows that can be displayed in the expression execution result. |
| params | No | Union[Mapping[Value, Any], None] | A mapping of scalar parameter expressions to their values. |
| block | No | bool | Whether to execute expressions asynchronously. If the value is True, an AsyncJob object is returned. |
| kwargs | No | - | Keyword arguments. |
Return type: Union[pandas.DataFrame, pandas.Series, AsyncJob, Any]
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_8", database='my_schema')
>>> ds.execute()
a b
0 1 c
1 1 a
2 2 a
[3 rows x 2 columns] filter
Description: Filters out rows that do not meet specified conditions.
Syntax:
filter(expr=None, fn=None, on=None, num_cpus=None, memory=None, arch=None, device=None, model=None, num_models=None, concurrency=None, **fn_constructor_kwargs)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| expr | No | Union[list[ir.BooleanValue], Sequence[ir.BooleanValue], IfAnyAll, None] | A valid Python expression string. |
| on | No | Union[str, list[str]] | Column to which the function is applied. |
| fn | No | Union[str, Callable, None] | Name of the function that can be called. |
| num_cpus | No | Union[float, None] | Number of CPUs. |
| memory | No | Union[int, None] | Memory size, in MB. |
| arch | No | Union[str, None] | Architecture type. The value can be x86 or arm. |
| device | No | Union[str, None] | Type of the AI processing unit. The value can be NPU or GPU. |
| model | No | Union[str, None] | Model of the AI processing unit, for example, 910B or A100. |
| num_models | No | Union[float, None] | Number of AI processing units. Configuration is supported only for NPUs and GPUs. |
| concurrency | No | Union[int, Tuple[int, int], None] | Concurrency during function execution. |
| fn_constructor_kwargs | No | - | Constructor arguments. This can only be provided when fn is a callable class. |
Return type: Filtered dataset after removing non-compliant rows.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_3", database='my_schema')
>>> ds = ds.filter(expr=[ds.a < 2])
>>> ds
| a | b |
| ----- | ----- |
| int64 | string|
| ----- | ----- |
| 1 | c |
| 1 | a |
# Filtered by User-defined functions
# my_schema.id_filter:inputting an int value, returning false if value is larger than 2.
>>> ds = con.load_dataset("demo_table_2", database='my_schema')
>>> ds = ds.filter(
... fn='my_schema.id_filter',
... on='a',
... )
>>> ds
| a | b |
| ----- | ----- |
| int64 | string|
| ----- | ----- |
| 1 | c |
| 1 | a | flat_map
Description: Applies a given function to each row of the dataset and flattens the results.
Syntax:
flat_map(fn, on, as_col=None, num_cpus=None, memory=None, arch=None, device=None, model=None, num_models=None, concurrency=None, **fn_constructor_kwargs)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| fn | Yes | Union[str, Callable] | Name of the function that can be called, for example, myschema.myfunction. |
| on | Yes | Union[str, list[str], ] | Column or set of columns to which the function is applied. |
| as_col | No | Union[str, list[str], None] | Name of the new column. Its length must match the number of fields returned by fn. |
| num_cpus | No | Union[float, None] | Number of CPUs. |
| memory | No | Union[int, None] | Memory size, in MB. |
| arch | No | Union[str, None] | Architecture type. The value can be x86 or arm. |
| device | No | Union[str, None] | Type of the AI processing unit. The value can be NPU or GPU. |
| model | No | Union[str, None] | Model of the AI processing unit, for example, 910B or A100. |
| num_models | No | Union[float, None] | Number of AI processing units. Configuration is supported only for NPUs and GPUs. |
| concurrency | No | Union[int, Tuple[int, int], None] | Concurrency during function execution. |
| fn_constructor_kwargs | No | - | Constructor arguments. This can only be provided when fn is a callable class. |
Return type:
Dataset: A dataset containing the new column(s) named as_col.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_2", database='my_schema')
>>> ds.execute()
a b c
0 1 4 1
[1 rows x 3 columns]
>>> ds = ds.flat_map(
... fn='my_schema.py_generate_series',
... on=['a', 'b', 'c'],
... as_col=['outCol'])
>>> ds
| a | b | c | outCol |
| ----- | ----- | ----- | ------ |
| int64 | int64 | int64 | int64 |
| ----- | ----- | ----- | ------ |
| 1 | 4 | 1 | 1 |
| 1 | 4 | 1 | 2 |
| 1 | 4 | 1 | 3 |
| 1 | 4 | 1 | 4 |
# Access table columns using the ds.attribute (dot notation) style
>>> ds = ds.flat_map(
... fn='my_schema.py_generate_series',
... on=[ds.a, ds.b, ds.c],
... as_col='udtf_col')
>>> ds
| a | b | c | udtf_col |
| ----- | ----- | ----- | -------- |
| int64 | int64 | int64 | int64 |
| ----- | ----- | ----- | -------- |
| 1 | 4 | 1 | 1 |
| 1 | 4 | 1 | 2 |
| 1 | 4 | 1 | 3 |
| 1 | 4 | 1 | 4 | map_batches
Description: Applies a given function to batch data.
Syntax:
map_batches(fn, on, as_col=None, num_cpus=None, memory=None, arch=None, device=None, model=None, num_models=None, concurrency=None, **fn_constructor_kwargs)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| fn | Yes | Union[str, Callable] | Name of the function that can be called, for example, myschema.myfunction. |
| on | Yes | Union[str, list[str], ] | Column or set of columns to which the function is applied. |
| as_col | No | Union[str, list[str], None] | Name of the new column. Its length must match the number of fields returned by fn. |
| num_cpus | No | Union[float, None] | Number of CPUs. |
| memory | No | Union[int, None] | Memory size, in MB. |
| arch | No | Union[str, None] | Architecture type. The value can be x86 or arm. |
| device | No | Union[str, None] | Type of the AI processing unit. The value can be NPU or GPU. |
| model | No | Union[str, None] | Model of the AI processing unit, for example, 910B or A100. |
| num_models | No | Union[float, None] | Number of AI processing units. Configuration is supported only for NPUs and GPUs. |
| concurrency | No | Union[int, Tuple[int, int], None] | Concurrency during function execution. |
| fn_constructor_kwargs | No | - | Constructor arguments. This can only be provided when fn is a callable class. |
Return type:
Dataset: A dataset containing the new column(s) named as_col.
groupby
Description: Creates a grouped dataset.
Syntax:
groupby(*by, **key_exprs)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| by | No | Union[str, Iterable[str], None] | Grouping expression. |
| key_exprs | No | Union[str, Iterable[str]] | Named grouping expression. |
Return type: A grouped dataset.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_14", database='my_schema')
>>> ds
| fruit | price |
| ------ | ----- |
| string | float |
| ------ | ----- |
| apple | 0.50 |
| apple | 0.50 |
| banana | 0.25 |
| orange | 0.33 | join
Description: Performs a join operation between two datasets.
Syntax:
join(ds, /, on=(), *, join_type='inner', left_suffix='left_', right_suffix='right_')
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| ds | Yes | Dataset | Right-side dataset to join with. |
| on | No | Union[str, Sequence[Union[str, BooleanColumn, Literal[True], Literal[False], tuple[str, str]]]] | Join condition. For details, see the example. |
| join_type | No | JoinKind | Join method, such as inner or left. |
| left_suffix | No | str | Suffix used to rename overlapping columns from the left table, for example, left_. |
| right_suffix | No | str | Suffix used to rename overlapping columns from the right table, for example, right_. |
Return type: The joined dataset.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds1 = con.load_dataset("demo_table_15", database='my_schema')
>>> ds2 = con.load_dataset("demo_table_16", database='my_schema')
# Equality inner join on the shared id column. Note the _right suffix added to all overlapping columns from the right # table (in this case only the "id" column).
>>> ds1.join(ds2, "id", join_type="inner")
| id | fruit | price | color |
| ------ | ------- | ------- | ------------- |
| int64 | string | float64 | string |
| ------ | ------- | ------- | ------------- |
| 2 | apple | 0.25 | Yellow |
| 3 | banana | 0.33 | Orange |
# Explicit equality join using the default join_type value of "inner". Note join_type there is no _right suffix added # to the movieId column since this is an inner join and the movieId column is part of the join condition.
>>> ds1.join(ds2, ds1.id == ds2.id)
| id | fruit | price | color |
|--------|---------|---------|---------------|
| int64 | string | float64 | string |
|--------|---------|---------|---------------|
| 2 | apple | 0.25 | Yellow |
| 3 | banana | 0.33 | Orange | map
Description: Applies a given function to each row of the current dataset.
Syntax:
map(fn, on, as_col=None, num_cpus=None, memory=None, arch=None, device=None, model=None, num_models=None, concurrency=None, **fn_constructor_kwargs)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| fn | Yes | Union[str, Callable] | Name of the function that can be called, for example, myschema.myfunction. |
| on | Yes | Union[str, list[str], ] | Column or set of columns to which the function is applied. |
| as_col | No | Union[str, list[str], None] | Name of the new column. Its length must match the number of fields returned by fn. |
| num_cpus | No | Union[float, None] | Number of CPUs. |
| memory | No | Union[int, None] | Memory size, in MB. |
| arch | No | Union[str, None] | Architecture type. The value can be x86 or arm. |
| device | No | Union[str, None] | Type of the AI processing unit. The value can be NPU or GPU. |
| model | No | Union[str, None] | Model of the AI processing unit, for example, 910B or A100. |
| num_models | No | Union[float, None] | Number of AI processing units. Configuration is supported only for NPUs and GPUs. |
| concurrency | No | Union[int, Tuple[int, int], None] | Concurrency during function execution. |
| fn_constructor_kwargs | No | - | Constructor arguments. This can only be provided when fn is a callable class. |
Return type:
Dataset: A dataset with a new column (as_col) containing the results of the applied function.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table", database='my_schema')
>>> ds = ds.map(
... fn='my_schema.multiply_2',
... on=['col_a'],
... as_col='col_c'
... )
>>> ds
| col_a | col_b | col_c |
|-------|-------|-------|
| int64 | string | int64 |
|-------|-------|-------|
| 1 | c | 2 |
| 1 | a | 2 |
| 2 | a | 4 | order_by
Description: Sorts a dataset based on one or more expressions.
Syntax:
order_by(key, descending=False)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| key | No | Union[str, List[str], None] | Expression used for sorting. |
| descending | No | Union[bool, List[bool]] | Whether to sort data in descending order (DESC). The default value is False. |
Return type: Sorted dataset.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_15", database='my_schema')
>>> ds
| a | b | c |
|-------|--------|-------|
| 3 | a | 4 |
| 2 | B | 6 |
| 1 | c | 5 |
| 3 | D | 7 |
# Sort by b. Default is ascending. Note how capital letters come before lowercase
>>> ds.order_by("b")
| a | b | c |
|-------|--------|-------|
| int64 | string | int64 |
|-------|--------|-------|
| 2 | B | 6 |
| 3 | D | 7 |
| 3 | a | 4 |
| 1 | c | 5 |
# Sort in descending order
>>> ds.order_by(ds.b.desc())
| a | b | c |
|-------|--------|-------|
| int64 | string | int64 |
|-------|--------|-------|
| 1 | c | 5 |
| 3 | a | 4 |
| 3 | D | 7 |
| 2 | B | 6 |
# Sort by multiple columns/expressions
>>> ds.order_by(["a", ds.c.desc()])
| a | b | c |
|-------|--------|-------|
| int64 | string | int64 |
|-------|--------|-------|
| 1 | c | 5 |
| 2 | B | 6 |
| 3 | D | 7 |
| 3 | a | 4 | rename_columns
Description: Renames columns in a dataset.
Syntax:
rename_columns(names, /, **substitutions)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| names | Yes | Mapping[str, str] | A mapping (dictionary) specifying renaming rules as {New column name: Old column name}. Columns not included retain their original names. |
| substitutions | No | str | Columns to be explicitly renamed, specified as keyword arguments in the format of New name=Old name. |
Return type: A new dataset with renamed columns.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_8", database='my_schema')
>>> ds
| a | b |
|-------|--------|
| int64 | string |
|-------|--------|
| 1 | c |
| 1 | a |
| 2 | a |
>>> ds.rename_columns({"rename_col": "a"})
| rename_col | b |
|------------|--------|
| int64 | string |
|------------|--------|
| 1 | c |
| 1 | a |
| 2 | a | schema
Description: Returns the schema of a dataset.
Syntax:
schema()
Input parameters: None.
Return type: Schema object.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_7", database='my_schema')
>>> ds.schema()
ibis.Schema {
species string
island string
bill_length_mm float64
bill_depth_mm float64
flipper_length_mm int64
} select_columns
Description: Selects specified columns from a dataset.
Syntax:
select_columns(*exprs, **named_exprs)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| exprs | Yes | Union[Value, str, Iterable[Union[Value, str]]] | Column expressions, column name strings, or a list of these. |
| named_exprs | No | Union[Value, str] | Column expressions (named parameters are supported). |
Return type: A dataset containing the selected columns.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_5", database='my_schema')
>>> ds.select_columns("species", "bill_length_mm")
| species | bill_length_mm |
|------------|----------------|
| string | float64 |
|------------|----------------|
| Adelie | 40.0 |
| Adelie | 41.0 |
| Adelie | 42.0 |
| Adelie | 43.0 |
# Selection by zero-indexed column position
>>> ds.select_columns(ds[0], ds[4])
| species | flipper_length_mm |
|------------|-------------------|
| string | int64 |
|------------|-------------------|
| Adelie | 180 |
| Adelie | 183 |
| Adelie | 190 |
| Adelie | 185 | show
Description: Displays the data generated by the query results.
Syntax:
show(limit=10)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| limit | No | int | Maximum number of output rows. The default value is 10. |
Return type: None.
take
Description: Returns up to limit rows from the dataset, ideal for data inspection and previewing.
Syntax:
take(limit)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| limit | Yes | int | Maximum number of rows to be returned. |
Return type: list[dict[str, Any]]: A list containing up to limit rows, with each row represented as a dictionary.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_9", database='my_schema')
>>> ds.take(3)
[{'a': 1}, {'a': 1}, {'a': 2}] max
Description: Calculates the maximum value of specified columns in a dataset.
Syntax:
max(on=None)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| on | No | Union[str, list[str], None] | Columns for which to calculate the maximum value. |
Return type: Dataset.
min
Description: Calculates the minimum value of specified columns in a dataset.
Syntax:
min(on=None)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| on | No | Union[str, list[str], None] | Columns for which to calculate the minimum value. |
Return type: Dataset.
mean
Description: Calculates the mean value of specified columns in a dataset.
Syntax:
mean(on=None)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| on | No | Union[str, list[str], None] | Columns for which to calculate the mean value. |
Return type: Dataset.
unique
Description: Calculates a set of unique values from a specified column in a dataset.
Syntax:
unique(col)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| col | Yes | str | Column for which to calculate the unique values. |
Return type: list.
limit
Description: Selects rows from the current dataset starting at a given offset.
Syntax:
limit(n, /, *, offset=0)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| n | No | Union[int, None] | Number of rows to be included. If None, selects all rows from the offset. |
| offset | No | int | Number of rows to be skipped. |
Return type:
Dataset: N rows starting from the offset.
Example:
>>> from aura_frame.multimodal import ai_lake
>>> con = ai_lake.connect(
... aura_endpoint='*',
... access_key='*'
... secret_key='*'
... ...
... )
>>> ds = con.load_dataset("demo_table_4", database='my_schema')
>>> ds
| a | b |
|-------|--------|
| int64 | string |
|-------|--------|
| 1 | c |
| 1 | a |
| 2 | a |
>>> ds.limit(2)
| a | b |
|-------|--------|
| int64 | string |
|-------|--------|
| 1 | c |
| 1 | a |
| 2 | a |
# use None with offset to slice starting from a particular row
>>> ds.limit(None, offset=1)
| a | b |
|--------|--------|
| int64 | string |
|--------|--------|
| 1 | a |
| 2 | a | take_batch
Description: Returns up to batch_size rows from a dataset.
Syntax:
take_batch(batch_size=20, *, batch_format='default')
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| batch_size | No | int | Number of rows in a batch. The default value is 20. |
| batch_format | No | Optional[str] | Batch format.
|
Return type: Dataset in the specified format.
create_async_job
Description: Restores a job instance based on the job ID.
Syntax:
create_async_job(statement_id)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| statement_id | Yes | str | Unique identifier of a job. |
Return value: AsyncJob object.
explain_plan
Description: Generates the execution plan for a job.
Syntax:
explain_plan(verbose=True)
Input parameters:
| Parameter | Mandatory (Yes/No) | Data Type | Description |
|---|---|---|---|
| verbose | No | bool | If True, provide the detailed description of the query plan. If False, provide only a simple execution plan. |
Return type: str
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot