Skip to main content
Version: devel

dlt.destinations.impl.databricks.databricks_adapter

databricks_adapter

def databricks_adapter(
data: Any,
cluster: TColumnNames = None,
table_comment: Optional[str] = None,
table_tags: Optional[List[Union[str, Dict[str, str]]]] = None,
column_hints: Optional[TTableSchemaColumns] = None) -> DltResource

View source on GitHub

Prepares data for loading into Databricks.

This function takes data, which can be raw or already wrapped in a DltResource object, and prepares it for Databricks by optionally specifying clustering and table description.

Arguments:

  • data Any - The data to be transformed. This can be raw data or an instance of DltResource. If raw data is provided, the function will wrap it into a DltResource object.
  • cluster TColumnNames, optional - A column name or list of column names to cluster the Databricks table by.
  • table_comment str, optional - A description for the Databricks table.
  • table_tags List[Union[str, Dict[str, str]]], optional - A list of tags for the Databricks table. Can contain a mix of strings and key-value pairs as dictionaries.
  • Example - ["production", {"environment": "prod"}, "employees"]

Returns:

A DltResource object that is ready to be loaded into Databricks.

Raises:

  • ValueError - If any hint is invalid or none are specified.

Examples:

    data = [{"name": "Marcel", "description": "Raccoon Engineer", "date_hired": 1700784000}]
databricks_adapter(data, cluster="date_hired", table_comment="Employee Data",

... table_tags=["production", {"environment": "prod"}, "employees"])

This demo works on codespaces. Codespaces is a development environment available for free to anyone with a Github account. You'll be asked to fork the demo repository and from there the README guides you with further steps.
The demo uses the Continue VSCode extension.

Off to codespaces!

DHelp

Ask a question

Welcome to "Codex Central", your next-gen help center, driven by OpenAI's GPT-4 model. It's more than just a forum or a FAQ hub – it's a dynamic knowledge base where coders can find AI-assisted solutions to their pressing problems. With GPT-4's powerful comprehension and predictive abilities, Codex Central provides instantaneous issue resolution, insightful debugging, and personalized guidance. Get your code running smoothly with the unparalleled support at Codex Central - coding help reimagined with AI prowess.