- Python — Uses Pandas DataFrames. Best for smaller datasets and general-purpose data processing.
- Spark — Uses PySpark DataFrames. Best for large-scale distributed data processing.
Explore the SDK using Google Colab or check all templates navigating to Notebooks > Templates.
Getting started
Generate an access token
Generate a token with access to the resources you need (tables, volumes, secrets).
Install the SDK
The SDK is already included in Nekt Notebook templates. To install it in your own environment:
Configuration
You must setdata_access_token and engine before using any SDK method.
| Attribute | Required | Description |
|---|---|---|
nekt.data_access_token | Yes | Access token for authenticating with the Nekt API. Generate one here. |
nekt.engine | Yes | Processing engine: "python" (Pandas) or "spark" (PySpark). |
Reading data
Load table
Load table
Load a table from your Lakehouse as a DataFrame using the Example with Spark engine:
.load_table() method. Returns a Pandas DataFrame when engine="python" or a Spark DataFrame when engine="spark".Parameters:layer_name(str): The name of the layer where the table is locatedtable_name(str): The name of the table to load
engine="python") or Spark DataFrame (engine="spark")Example with Python engine:Load secret
Load secret
Load a secret value from your organization’s secrets vault using the
.load_secret() method.Parameters:key(str): The secret key to retrieve
Your access token must have permission to access the secret.
Load volume
Load volume
List files in a volume from your Lakehouse using the
.load_volume() method.Parameters:layer_name(str): The name of the layer where the volume is locatedvolume_name(str): The name of the volume
Load Delta table
Load Delta table
Load a Delta table object from your Lakehouse using the
.load_delta_table() method. This gives you access to Delta Lake features like ACID transactions and time travel.Parameters:layer_name(str): The name of the layer where the table is locatedtable_name(str): The name of the table to load
Writing data
save_table is only available when running inside Nekt Notebooks. When running locally, this method prints a message indicating it is not available.Save table
Save table
Save a DataFrame as a table in your Lakehouse using the Example — append:Example — merge (upsert):Schema evolution strategies:
.save_table() method. Supports overwrite, append, and merge (upsert) modes with automatic schema evolution.Parameters:df(DataFrame): The DataFrame to save (Pandas or Spark, depending on your engine)layer_name(str): The name of the target layertable_name(str): The name of the table to create or updatefolder_name(str, optional): Folder within the layer. Defaults to the layer rootmode(str, optional): Write mode —"overwrite","append", or"merge". Defaults to"overwrite"merge_keys(list[str], optional): Column names used as keys for merge mode. Required whenmode="merge"schema_evolution(str, optional): Schema evolution strategy —"merge","strict", or"overwrite". Defaults to"merge"
| Strategy | Behavior |
|---|---|
"merge" | New columns are added automatically. Existing columns are preserved. |
"strict" | Schema must match exactly. Raises an error if columns differ. |
"overwrite" | The table schema is replaced with the DataFrame schema. |
Logging
The SDK provides a built-in logger for tracking execution progress. Inside Nekt Notebooks, logs are visible in the Nekt UI. Outside Nekt, logs go to standard error output.Default logger
Usenekt.logger to log messages directly:
Named loggers
Usenekt.get_logger(name) to create a named sub-logger. Messages are automatically prefixed with the logger name, making it easier to identify which part of your code produced each log entry.
Utilities
Get Spark session
Get Spark session
Access the shared Spark session using the
.get_spark_session() method. Useful for creating DataFrames manually or running Spark operations directly.Returns: SparkSession objectExample: