Load actions¶
A load action ingests data into a temporary view. Every load action sets
type: load, a source: mapping whose source.type selects the source
sub-type, and a target: naming the view it creates:
- name: <action_name>
type: load
source:
type: <cloudfiles|delta|sql|python|jdbc|kafka|custom_datasource>
...
target: <view_name>
See also
How-to guides: Incrementally ingest files with Auto Loader, Ingest from a Delta table, Ingest with a SQL query, Ingest from a database over JDBC, Ingest a streaming Kafka topic, Ingest from a custom data source.
Action-level fields¶
These fields apply to every load sub-type. All except source/target
are optional.
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
Yes |
— |
Unique action name within the flowgroup. |
|
string |
Yes |
— |
Always |
|
mapping |
Yes |
— |
Source configuration. |
|
string |
Yes |
— |
Name of the temporary view this action creates. |
|
string |
No |
sub-type |
|
|
string |
No |
auto |
Docstring for the generated view function. |
|
bool or list[string] |
No |
— |
|
cloudfiles¶
Streams files into a temporary view via Databricks Auto Loader. Fields live
under source:.
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
Yes |
— |
Must be |
|
string |
Yes |
— |
File path or glob to ingest. |
|
string |
Yes |
— |
File format; feeds |
|
mapping |
No |
— |
|
|
mapping |
No |
— |
Options merged verbatim into the reader. |
|
mapping |
No |
— |
Options prefixed with |
|
string or mapping |
No |
— |
Schema-file path, or |
|
string |
No |
— |
Back-compat schema-file path. |
readMode must be stream (batch is rejected). Legacy scalar options
(schema_location, schema_infer_column_types, max_files_per_trigger,
schema_evolution_mode, rescue_data_column) are accepted for
back-compat but are superseded by options.
- name: load_orders
type: load
source:
type: cloudfiles
path: "${landing_volume}/orders/*.json"
format: json
target: v_orders_raw
delta¶
Reads a Delta table into a temporary view. Fields live under source:.
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
Yes |
— |
Must be |
|
string |
Yes |
— |
Catalog of the source table. |
|
string |
Yes |
— |
Schema of the source table. |
|
string |
Yes |
— |
Source table name. |
|
mapping |
No |
— |
Delta reader options (values must be non-empty). CDC and time-travel keys go here. |
|
list[string] |
No |
|
Filter expressions applied with |
|
list[string] |
No |
— |
Column projection applied with |
readMode defaults to batch and accepts batch or stream.
options.readChangeFeed: "true" requires readMode: stream, or a
startingVersion/startingTimestamp bound in batch mode.
- name: load_customers
type: load
source:
type: delta
catalog: "${catalog}"
schema: "${bronze_schema}"
table: customers
readMode: batch
target: v_customers
sql¶
Materializes a SQL query into a temporary view. source: may be an inline
SQL string, or a mapping carrying sql or sql_path.
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
Yes |
— |
Must be |
|
string |
One of |
— |
Inline SQL query. Provide exactly one of |
|
string |
One of |
— |
Path to an external |
readMode is ignored for SQL loads (always a spark.sql call).
Substitution tokens (${token}, ${secret:scope/key}) resolve in both
inline SQL and external files.
- name: load_summary
type: load
source:
type: sql
sql: "SELECT * FROM ${catalog}.${bronze_schema}.orders"
target: v_orders
python¶
Calls a Python function that returns a DataFrame. Fields live under
source:.
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
Yes |
— |
Must be |
|
string |
Yes |
— |
Path to a |
|
string |
No |
|
Entry function, called as |
|
mapping |
No |
|
Passed as the function’s second argument. |
- name: load_external
type: load
source:
type: python
module_path: "loaders/external.py"
function_name: get_df
parameters:
region: "${region}"
target: v_external
jdbc¶
Reads from an external database over JDBC. Fields live under source:.
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
Yes |
— |
Must be |
|
string |
Yes |
— |
JDBC URL. |
|
string |
Yes |
— |
Username; supply via |
|
string |
Yes |
— |
Password; supply via |
|
string |
Yes |
— |
JDBC driver class. |
|
string |
One of |
— |
Table name. Provide exactly one of |
|
string |
One of |
— |
SQL query. Provide exactly one of |
- name: load_jdbc
type: load
source:
type: jdbc
url: "jdbc:postgresql://host:5432/db"
user: "${secret:db/user}"
password: "${secret:db/password}"
driver: org.postgresql.Driver
table: public.orders
target: v_orders
kafka¶
Streams from Apache Kafka (or Kafka-protocol-compatible endpoints) into a
temporary view. Fields live under source:.
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
Yes |
— |
Must be |
|
string |
Yes |
— |
Maps to |
|
string |
One of |
— |
Topic(s). Provide exactly one of |
|
string |
One of |
— |
Topic regex. One of the three subscription methods. |
|
string (JSON) |
One of |
— |
Partition assignment. One of the three subscription methods. |
|
mapping |
No |
— |
Extra |
readMode must be stream (batch is rejected). Kafka returns binary
key/value columns — deserialize them in a downstream transform.
- name: load_events
type: load
source:
type: kafka
bootstrap_servers: "broker1:9092,broker2:9092"
subscribe: orders
target: v_events
custom_datasource¶
Reads through a user-supplied PySpark DataSource class. Fields live under
source:.
Field |
Type |
Required |
Default |
Description |
|---|---|---|---|---|
|
string |
Yes |
— |
Must be |
|
string |
Yes |
— |
Path to the |
|
string |
Yes |
— |
Name of the |
|
mapping |
No |
|
Passed to the reader as |
readMode defaults to stream; batch is also supported. The class’s
name() classmethod return value is used as the .format(...) name.
- name: load_custom
type: load
source:
type: custom_datasource
module_path: "sources/my_source.py"
custom_datasource_class: MyDataSource
options:
endpoint: "${api_endpoint}"
target: v_custom