Skip to content

Commit

Permalink
support sets for pyarrow
Browse files Browse the repository at this point in the history
  • Loading branch information
karakanb committed Nov 23, 2024
1 parent 0fce1c8 commit 816b7d3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dlt/common/libs/pyarrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,15 +620,15 @@ def row_tuples_to_arrow(
)
float_array = pa.array(columnar_known_types[field.name], type=pa.float64())
columnar_known_types[field.name] = float_array.cast(field.type, safe=False)
if issubclass(py_type, (dict, list)):
if issubclass(py_type, (dict, list, set)):
logger.warning(
f"Field {field.name} was reflected as JSON type and needs to be serialized back to"
" string to be placed in arrow table. This will slow data extraction down. You"
" should cast JSON field to STRING in your database system ie. by creating and"
" extracting an SQL VIEW that selects with cast."
)
json_str_array = pa.array(
[None if s is None else json.dumps(s) for s in columnar_known_types[field.name]]
[None if s is None else json.dumps(s) if not issubclass(type(s), set) else json.dumps(list(s)) for s in columnar_known_types[field.name]]
)
columnar_known_types[field.name] = json_str_array

Expand Down
4 changes: 2 additions & 2 deletions docs/website/docs/general-usage/credentials/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ keywords: [credentials, secrets.toml, secrets, config, configuration, environmen
---
import DocCardList from '@theme/DocCardList';

`dlt` pipelines usually require configurations and credentials. These can be set up in [various ways](./setup):
`dlt` pipelines usually require configurations and credentials. These can be set up in [various ways](setup):

1. Environment variables
2. Configuration files (`secrets.toml` and `config.toml`)
3. Key managers and vaults

`dlt` automatically extracts configuration settings and secrets based on flexible [naming conventions](./setup/#naming-convention). It then [injects](./advanced/#injection-mechanism) these values where needed in code.
`dlt` automatically extracts configuration settings and secrets based on flexible [naming conventions](setup/#naming-convention). It then [injects](advanced/#injection-mechanism) these values where needed in code.

# Learn details about

Expand Down

0 comments on commit 816b7d3

Please sign in to comment.