Explore the SDK using Google Colab or check all templates.
How to use Nekt SDK
- Generate a token with access to the appropriate resources (tables, volumes, secrets). This is the safest way to secure your resources outside Nekt environment.
- Install the SDK (already included in our templates):
- Using the SDK
Nekt SDK methods
Find all functions available listed here:Initialize the SDK (required)
Initialize the SDK (required)
Load table
Load table
Load a table from your lakehouse as a Spark DataFrame using the We recommend using type hinting to make this explicit:
.load_table() method.Parameters:layer_name(str): The name of the layer where the table is locatedtable_name(str): The name of the table you want to load
Save table
Save table
Save a Spark DataFrame as a table in your lakehouse using the Example without folder:Example with append mode:
.save_table() method.Parameters:df(DataFrame): The Spark DataFrame to savelayer_name(str): The name of the layer where the table will be savedtable_name(str): The name of the table to createfolder_name(str, optional): The folder name within the layer. If not provided, the table will be saved in the root of the layermode(str, optional): Write mode -"overwrite","append", or"merge". Defaults to"overwrite"merge_keys(list[str], optional): Keys for merge mode. Required when usingmode="merge"schema_evolution(str, optional): Schema evolution strategy -"merge","strict", or"overwrite". Defaults to"merge"
Get Spark session
Get Spark session
Access the shared Spark session instance using the
.get_spark_session() method. This is useful when you need direct access to Spark operations, like creating a new dataframe with custom schema or data.Returns: SparkSession objectExample:Load volume
Load volume
Load a volume from your lakehouse using the
.load_volume() method. Volumes allow you to store and access unstructured data files.Parameters:layer_name(str): The name of the layer where the volume is locatedvolume_name(str): The name of the volume you want to load
Load secret
Load secret
Load a secret value from your organization’s secrets vault using the
.load_secret() method. Secrets are useful for storing sensitive information like API keys and credentials.Parameters:key(str): The secret key to retrieve
Make sure your token has permission to access the secret you’re trying to load.
Load Delta table (advanced)
Load Delta table (advanced)
Load a Delta table from your lakehouse using the
.load_delta_table() method.All data stored on your lakehouse is saved on delta format, and you can leverage it if needed (delta tables provide ACID transactions and time travel capabilities).Parameters:layer_name(str): The name of the layer where the Delta table is locatedtable_name(str): The name of the Delta table you want to load