Skip to content

Commit

Permalink
small edits
Browse files Browse the repository at this point in the history
  • Loading branch information
AstrakhantsevaAA committed Mar 25, 2024
1 parent c9c9b34 commit 8d139dc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/website/docs/general-usage/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,26 +280,28 @@ def my_resource():
for i in range(10):
yield {'my_column': i % 2 == 0}
```
This code snippet sets up a nullable boolean column named `column_name` directly in the decorator.
This code snippet sets up a nullable boolean column named `my_column` directly in the decorator.

#### Using `apply_hints`
#### Using `apply_hints`
When dealing with dynamically generated resources or needing to programmatically set hints, `apply_hints` is your tool. It's especially useful for applying hints across various collections or tables at once.

For example, to apply a complex data type across all collections from a MongoDB source:

```py
all_collections = ["collection1", "collection2", "collection3"] # replace with your actual collection names
source_data = mongodb().with_resources(*all_collections)
for col in all_collections:
source_data.resources[col].apply_hints(columns={"column_name": {"data_type": "complex"}})
pipeline = dlt.pipeline(
pipeline_name="mongodb_pipeline",
destination="duckdb",
dataset_name="mongodb_data"
)
load_info = pipeline.run(source_data)
```
This example iterates through MongoDB collections, applying the complex data type to a specified column, and then processes the data with `pipeline.run`.
This example iterates through MongoDB collections, applying the complex [data type](schema#data-types) to a specified column, and then processes the data with `pipeline.run`.

## Export and import schema files

Expand Down

0 comments on commit 8d139dc

Please sign in to comment.