-
Notifications
You must be signed in to change notification settings - Fork 415
Updated resource docs on info for materializing empty tables #2973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated resource docs on info for materializing empty tables #2973
Conversation
✅ Deploy Preview for dlt-hub-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| You can emit columns as a Pydantic model and use dynamic hints (i.e., lambda for table name) as well. You should avoid redefining `Incremental` this way. | ||
| ::: | ||
|
|
||
| Great — here’s a tightened, clear, LLM‑friendly version that keeps your intent and adds just enough structure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
| Sometimes you need a table to exist with no rows. Examples: | ||
|
|
||
| - Prepare empty tables for downstream jobs. | ||
| - Publish a schema before data arrives. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link "Adjust schema" here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
|
|
||
| Then define the resource function and yield an empty dict (`{}`). dlt creates an empty table with all declared columns. Only the metadata columns `_dlt_id` and `_dlt_load_id` will have values. | ||
|
|
||
| > Note: The load will fail if the schema marks any columns as `NOT NULL` i.e. `"nullable": False`. Ensure all non-metadata columns are nullable when loading an empty table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use admonitions:
:::note
...
::::
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| Example: | ||
| ```py | ||
| @dlt.resource( | ||
| table_name="raw_events_apply_hints_yield_dict", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| table_name="raw_events_apply_hints_yield_dict", | |
| table_name="your_table_name", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| To create an empty table, declare the schema explicitly. Do this either: | ||
|
|
||
| - in the resource function with `@dlt.resource`, or | ||
| - by applying hints with `apply_hints`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- link "Adjust schema" here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
…s-on-empty-table-materializtion
Description
Updated resource docs on info for materializing empty tables
Related Issues
apply_hintsand@dlt.resource(columns=…)) do not materialize schema #2901apply_hintsand@dlt.resource(columns=…)) do not materialize schema #2901