Skip to content

Conversation

@dat-a-man
Copy link
Collaborator

@dat-a-man dat-a-man self-assigned this Aug 7, 2025
@dat-a-man dat-a-man added the documentation Improvements or additions to documentation label Aug 7, 2025
@netlify
Copy link

netlify bot commented Aug 7, 2025

Deploy Preview for dlt-hub-docs ready!

Name Link
🔨 Latest commit 52ba468
🔍 Latest deploy log https://app.netlify.com/projects/dlt-hub-docs/deploys/68bea1f11530bc0008a3ddde
😎 Deploy Preview https://deploy-preview-2973--dlt-hub-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.....

Copy link
Collaborator Author

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

link "Adjust schema" here

Copy link
Collaborator Author

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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use admonitions:
:::note
...
::::

Copy link
Collaborator Author

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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
table_name="raw_events_apply_hints_yield_dict",
table_name="your_table_name",

Copy link
Collaborator Author

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`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • link "Adjust schema" here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

@AstrakhantsevaAA AstrakhantsevaAA merged commit 3812c8f into devel Sep 8, 2025
39 checks passed
@AstrakhantsevaAA AstrakhantsevaAA deleted the docs/2901-update-docs-on-empty-table-materializtion branch September 8, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty‐list resources (apply_hints and @dlt.resource(columns=…)) do not materialize schema

3 participants