mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-10 08:05:14 +02:00
fix(context): normalize manifest column identifiers
This commit is contained in:
parent
cf93ee53bd
commit
9938469b2d
7 changed files with 477 additions and 29 deletions
|
|
@ -62,6 +62,39 @@ class TestSimpleSingleSource:
|
|||
assert "GROUP BY" in sql.upper()
|
||||
assert "public.orders" in sql
|
||||
|
||||
def test_computed_column_can_reference_quoted_physical_name(self):
|
||||
source = SourceDefinition(
|
||||
name="npi",
|
||||
table="provider.main.npi",
|
||||
grain=["provider_business_mailing_address_country_code_if_outside_u_s"],
|
||||
columns=[
|
||||
SourceColumn(
|
||||
name="provider_business_mailing_address_country_code_if_outside_u_s",
|
||||
type="string",
|
||||
expr='npi."provider_business_mailing_address_country_code_(if_outside_u.s.)"',
|
||||
)
|
||||
],
|
||||
)
|
||||
sources = {"npi": source}
|
||||
engine = SemanticEngine.from_sources(sources, dialect="duckdb")
|
||||
|
||||
sql = engine.query(
|
||||
{
|
||||
"measures": [],
|
||||
"dimensions": [
|
||||
"npi.provider_business_mailing_address_country_code_if_outside_u_s"
|
||||
],
|
||||
"limit": 5,
|
||||
}
|
||||
).sql
|
||||
|
||||
assert_valid_sql(sql)
|
||||
assert (
|
||||
'npi."provider_business_mailing_address_country_code_(if_outside_u.s.)"'
|
||||
in sql
|
||||
)
|
||||
assert "AS provider_business_mailing_address_country_code_if_outside_u_s" in sql
|
||||
|
||||
|
||||
class TestCrossSourceM2O:
|
||||
"""Test 2: Cross-source, all m2o (the LATAM query)."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue