Structured Dataset 'source' representation #109
Replies: 8 comments 3 replies
-
|
+1 for having a structured source representation.
FWIW, our requirement would be to refer data products (instead of direct SQL), so supporting different Example: |
Beta Was this translation helpful? Give feedback.
-
|
Just thinking loudly.... Could we simplify it to smth like this: - name: orders
source:
object: sales.public.orders
- name: high_value_orders
source:
sql:
dialects:
- dialect: ANSI_SQL
expression: |
select order_id, customer_id, revenue
from sales.public.orders
where revenue > 10000I mean |
Beta Was this translation helpful? Give feedback.
-
|
+1. This aligns with our design goals. I'd suggest we keep both - name: orders
source:
kind: table
expression: sales.public.orders
- name: high_value_orders
source:
kind: query
expression: |
select order_id, customer_id, revenue
from sales.public.orders
where revenue > 10000This pattern:
|
Beta Was this translation helpful? Give feedback.
-
|
It is important to specify the SQL dialects that each query adheres to(dialect: ANSI_SQL), since many contemporary database systems incorporate non‑ANSI clauses and proprietary extensions . sql:
|
Beta Was this translation helpful? Give feedback.
-
|
In that case we can adhere to the original proposal structure and keep adding various Current ProposalThe original structure with explicit - name: orders
source:
kind: table
object: sales.public.orders
- name: high_value_orders
source:
kind: query
sql:
dialects:
- dialect: ANSI_SQL
expression: |
select order_id, customer_id, revenue
from sales.public.orders
where revenue > 10000Extending with Additional KindsAs requirements evolve (like jochenchrist's data product use case), we can add new kinds with their own reference semantics: - name: orders
source:
kind: table
object: sales.public.orders
- name: high_value_orders
source:
kind: query
sql:
dialects:
- dialect: ANSI_SQL
expression: |
select order_id, customer_id, revenue
from sales.public.orders
where revenue > 10000
- name: sales_summary
source:
kind: dataproduct
references:
dataproduct: sales_data
outputport: bigquery_prod_v1
version: "1.0"Benefits
The |
Beta Was this translation helpful? Give feedback.
-
|
The One dimension worth considering early: validated vs. raw SQL in - name: high_value_orders
source:
kind: query
sql:
dialects:
- dialect: ANSI_SQL
expression: |
select order_id, customer_id, revenue
from sales.public.orders
where revenue > 10000
validation:
status: verified # or 'draft', 'generated'
verified_against: postgres_15This matters especially as natural language → SQL tools become more common in data workflows. Tools like ai2sql.io generate syntactically correct SQL from plain-English descriptions, but the output often needs dialect-specific adjustment (e.g., On KSDaemon's simplification proposal — dropping Disclosure: I work on ai2sql.io — a natural language to SQL tool. The dialect-awareness discussion here maps directly to challenges we see in query generation across database engines. |
Beta Was this translation helpful? Give feedback.
-
|
I just found this topic, after I posted a very similar one: We use discriminator column a lot have multiple similar datasets in 1 table. Its a legacy database. What we need is just a simple filter on this discriminator column. This can be done using the full query in souce, but I would prefer to have the filter stored separately. like this: |
Beta Was this translation helpful? Give feedback.
-
It might be better to use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Structured Source Representation
Replace the current simple source handling with a structured source shape that makes the distinction between object-backed and query-backed datasets explicit, instead of leaving it to converter guesswork.
Before
In both cases,
sourceis just a string, so the mapping layer has to infer whether it represents an object reference or SQL text.After
Why
This makes the source shape explicit, removes ambiguity, and gives a clearer and more reliable basis for conversion.
kind: tablekind: querydialectslistBeta Was this translation helpful? Give feedback.
All reactions