Skip to content
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
825610c
rename flag for executing raw queries to "execute_raw_query"
sh-rp Jun 5, 2025
c149269
return sge queries from the internal _query method which removes a lo…
sh-rp Jun 5, 2025
70116a6
adds some tests to readable dataset and a test for column hint merging
sh-rp Jun 5, 2025
51a91ca
allows any dialect when writing queries and fixes tests
sh-rp Jun 5, 2025
20405f1
update docs and set correct quoting to queries in normalization and l…
sh-rp Jun 5, 2025
c428342
fixes normalizer tests
sh-rp Jun 5, 2025
ec985e4
fix limit on mssql
sh-rp Jun 6, 2025
f153a9b
add missing quote to alias
sh-rp Jun 6, 2025
1238ce0
revert identifier normalization step in normalizer_query and use bigq…
sh-rp Jun 11, 2025
e58ceab
post rebase fix
sh-rp Jun 25, 2025
4af4ef3
smallish pr fixes
sh-rp Jun 25, 2025
1a54a4c
add materializable sqlmodel and handle hints in extractor
sh-rp Jun 25, 2025
7fc4753
add and test always_materialize setting
sh-rp Jun 26, 2025
d8c30a1
add test for sql transformation type
sh-rp Jun 26, 2025
de3d7f0
convert transformation functions to need yield instead of return
sh-rp Jun 26, 2025
30f230d
migrate tests and docs snippets to yield in transformations
sh-rp Jun 26, 2025
f065066
add simple test for materializable model
sh-rp Jun 26, 2025
d33f198
use correct compiler for converting ibis into sqlglot for each dialect
sh-rp Jun 26, 2025
8aa9d7b
add first simple version of using unbound ibis tables in transformations
sh-rp Jun 26, 2025
f6a7b10
skip ibis test on python 3.9
sh-rp Jun 27, 2025
6a77610
Merge branch 'devel' into feat/transformations-more-decoupling
sh-rp Jun 27, 2025
fbd6c2b
fix query building in new relation
sh-rp Jun 27, 2025
1479d5b
return a "real" relation from a transformation
sh-rp Jun 27, 2025
77330c2
add ibis option when getting table from dataset
sh-rp Jun 27, 2025
af42236
update model item format tests to use relation
sh-rp Jun 30, 2025
a6cabe6
* remove one unneeded test (same thing is already tested in transform…
sh-rp Jun 30, 2025
166d446
adds support for adding resource hints to pyarrow items
sh-rp Jun 30, 2025
4c720da
switch most read access tests to default dataset
sh-rp Jun 30, 2025
d4d3285
update datasets and transformations docs pages
sh-rp Jun 30, 2025
f6acbb3
separate ibis and default dbapi datasets and fix typing
sh-rp Jun 30, 2025
de1fdf3
update transformation tests and small typing fixes for updated datasets
sh-rp Jun 30, 2025
5bc6470
fix default dataset type
sh-rp Jun 30, 2025
2881db0
fix wei sqlglot conversion
sh-rp Jun 30, 2025
fb983e3
add sqlglot dialect type and some cleanup
sh-rp Jun 30, 2025
9a5f1b0
fix dataset snippets
sh-rp Jun 30, 2025
4578eb9
fix sqlglot schema test
sh-rp Jun 30, 2025
fde9bd5
removes ibis relation and dataset
sh-rp Jul 1, 2025
34a8eac
fix one doc snippet
sh-rp Jul 1, 2025
9345476
rename dataset and relation interfaces
sh-rp Jul 1, 2025
cea5cb9
fix relation ship between cursor and relation, remove function wiring…
sh-rp Jul 1, 2025
a7b550b
clean up readablerelation (no actual code changes)
sh-rp Jul 1, 2025
9872119
fix str test to assume pretty sql (which it is now)
sh-rp Jul 1, 2025
3d6112e
small changes from review comments:
sh-rp Jul 1, 2025
6bc1f20
rename query method to "to_sql" on relation
sh-rp Jul 1, 2025
d08aa96
clean up transform function a bit (could maybe be even better=
sh-rp Jul 1, 2025
540e395
add support for "non-generator" transformations
sh-rp Jul 1, 2025
7b9e8df
move hints computation into resource class
sh-rp Jul 1, 2025
41e1239
smallish PR fixes
sh-rp Jul 2, 2025
57e09fd
add support for dynamic hints in transformations
sh-rp Jul 2, 2025
0eccfdd
fixes dynamic table caching
rudolfix Jul 2, 2025
a141170
Enhances ReadableDBAPIRelation: min/max, filter with expression (#2833)
anuunchin Jul 4, 2025
15b4a43
Merge branch 'devel' into feat/transformations-more-decoupling
sh-rp Jul 4, 2025
3b46e8a
prevent sqglot schema from adding default hints info, only allow para…
sh-rp Jul 4, 2025
5b906ad
make multi schema transformations work again
sh-rp Jul 4, 2025
44ae438
move model item format tests to transformations folder
sh-rp Jul 4, 2025
089f5ec
re-order interface tests and fix playground dataset access
sh-rp Jul 5, 2025
b06d715
PR review test updated
sh-rp Jul 7, 2025
c5f9b33
update dataset and transformation pages
sh-rp Jul 7, 2025
b6577fd
Merge branch 'devel' into feat/transformations-more-decoupling
sh-rp Jul 9, 2025
63dfa5f
update transformations tests to new fruitshop
sh-rp Jul 9, 2025
83372df
Last PR fixes
sh-rp Jul 11, 2025
bd4cfd7
update columns_schema property
sh-rp Jul 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
pytest tests/pipeline/test_pipeline_extra.py -k arrow ${{ matrix.pytest_args }}

- name: Install pipeline and sources dependencies
run: uv sync ${{ matrix.uv_sync_args }} --extra duckdb --extra cli --extra parquet --extra deltalake --extra sql_database --group sentry-sdk --group pipeline --group sources
run: uv sync ${{ matrix.uv_sync_args }} --extra duckdb --extra cli --extra parquet --extra deltalake --extra sql_database --group sentry-sdk --group pipeline --group sources --group ibis

- name: Run extract and pipeline tests
run: |
Expand Down
4 changes: 3 additions & 1 deletion dlt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
from dlt.extract.decorators import source, resource, transformer, defer
from dlt.destinations.decorators import destination
from dlt.transformations.decorators import transformation
from dlt.destinations.dataset import dataset, ReadableDBAPIDataset as Dataset
from dlt.common.destination.dataset import Dataset, Relation
from dlt.destinations.dataset import dataset

from dlt.pipeline import (
pipeline as _pipeline,
Expand Down Expand Up @@ -82,6 +83,7 @@
"sources",
"destinations",
"Dataset",
"Relation",
"dataset",
"transformation",
]
Expand Down
13 changes: 3 additions & 10 deletions dlt/common/data_writers/writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,9 @@ def write_header(self, columns_schema: TTableSchemaColumns) -> None:
def write_data(self, items: Sequence[TDataItem]) -> None:
super().write_data(items)
for item in items:
dialect = item.dialect or (self._caps.sqlglot_dialect if self._caps else None)
query = item.query
parsed_query = sqlglot.parse_one(query, read=dialect)

# Ensure the parsed query is a SELECT statement
if not isinstance(parsed_query, sqlglot.exp.Select):
raise ValueError("Only SELECT statements are allowed to write model files.")

normalized_query = parsed_query.sql(dialect=dialect)
self._f.write("dialect: " + (dialect or "") + "\n" + normalized_query + "\n")
dialect = item.query_dialect() or (self._caps.sqlglot_dialect if self._caps else None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it possible to not have query_dialect?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What we can do is to always save all queries in the duckdb dialect for example and transpile them to the right dialect before execution. This was actually the original implementation but by your request we are now saving the queries in the dialect of the dataset they where created on. Or do you just want to get rid of this method? Anyway, either way is fine by me, let me know.

Copy link
Collaborator

Choose a reason for hiding this comment

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

my question was: can item.query_dialect() NOT return a dialect in current impl? so we can remove expression after "or"

query = item.to_sql()
self._f.write("dialect: " + (dialect or "") + "\n" + query + "\n")

@classmethod
def writer_spec(cls) -> FileWriterSpec:
Expand Down
5 changes: 2 additions & 3 deletions dlt/common/destination/capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Any,
Callable,
ClassVar,
Iterable,
Literal,
Optional,
Sequence,
Expand All @@ -12,7 +11,7 @@
Protocol,
Type,
)
from dlt.common.data_types import TDataType
from dlt.common.libs.sqlglot import TSqlGlotDialect
from dlt.common.exceptions import TerminalValueError
from dlt.common.normalizers.typing import TNamingConventionReferenceArg
from dlt.common.typing import TLoaderFileFormat, get_args
Expand Down Expand Up @@ -202,7 +201,7 @@ class DestinationCapabilitiesContext(ContainerInjectableContext):
enforces_nulls_on_alter: bool = True
"""Tells if destination enforces null constraints when adding NOT NULL columns to existing tables"""

sqlglot_dialect: Optional[str] = None
sqlglot_dialect: Optional[TSqlGlotDialect] = None
"""The SQL dialect used by sqlglot to transpile a query to match the destination syntax."""

def generates_case_sensitive_identifiers(self) -> bool:
Expand Down
Loading
Loading