pytrilogy 0.0.1.106__py3-none-any.whl → 0.0.1.107__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pytrilogy might be problematic. Click here for more details.
- {pytrilogy-0.0.1.106.dist-info → pytrilogy-0.0.1.107.dist-info}/METADATA +79 -1
- {pytrilogy-0.0.1.106.dist-info → pytrilogy-0.0.1.107.dist-info}/RECORD +10 -10
- {pytrilogy-0.0.1.106.dist-info → pytrilogy-0.0.1.107.dist-info}/WHEEL +1 -1
- trilogy/__init__.py +1 -1
- trilogy/core/models.py +1 -1
- trilogy/dialect/base.py +3 -3
- trilogy/dialect/bigquery.py +1 -1
- {pytrilogy-0.0.1.106.dist-info → pytrilogy-0.0.1.107.dist-info}/LICENSE.md +0 -0
- {pytrilogy-0.0.1.106.dist-info → pytrilogy-0.0.1.107.dist-info}/entry_points.txt +0 -0
- {pytrilogy-0.0.1.106.dist-info → pytrilogy-0.0.1.107.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pytrilogy
|
|
3
|
-
Version: 0.0.1.
|
|
3
|
+
Version: 0.0.1.107
|
|
4
4
|
Summary: Declarative, typed query language that compiles to SQL.
|
|
5
5
|
Home-page:
|
|
6
6
|
Author:
|
|
@@ -275,3 +275,81 @@ but all are worth checking out. Please open PRs/comment for anything missed!
|
|
|
275
275
|
- [malloy](https://github.com/malloydata/malloy)
|
|
276
276
|
- [preql](https://github.com/erezsh/Preql)
|
|
277
277
|
- [PREQL](https://github.com/PRQL/prql)
|
|
278
|
+
|
|
279
|
+
## Minimal Syntax Reference
|
|
280
|
+
|
|
281
|
+
#### IMPORT
|
|
282
|
+
|
|
283
|
+
`import <path> as <alias>;`
|
|
284
|
+
|
|
285
|
+
#### CONCEPT
|
|
286
|
+
|
|
287
|
+
Types: `string | int | float | bool | date | datetime | time | timestamp | interval`;
|
|
288
|
+
|
|
289
|
+
Key:
|
|
290
|
+
`key <name> <type>;`
|
|
291
|
+
|
|
292
|
+
Property:
|
|
293
|
+
`property <key>.<name> <type>;`
|
|
294
|
+
|
|
295
|
+
Transformation:
|
|
296
|
+
`auto <name> <- <expression>;`
|
|
297
|
+
|
|
298
|
+
#### DATASOURCE
|
|
299
|
+
```sql
|
|
300
|
+
datasource <name>(
|
|
301
|
+
<column>:<concept>,
|
|
302
|
+
<column>:<concept>,
|
|
303
|
+
)
|
|
304
|
+
grain(<concept>, <concept>)
|
|
305
|
+
address <table>;
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
#### SELECT
|
|
309
|
+
|
|
310
|
+
Primary acces
|
|
311
|
+
|
|
312
|
+
```sql
|
|
313
|
+
select
|
|
314
|
+
<concept>,
|
|
315
|
+
<concept>+1 -> <alias>
|
|
316
|
+
WHERE
|
|
317
|
+
<concept> = <value>
|
|
318
|
+
ORDER BY
|
|
319
|
+
<concept> asc|desc
|
|
320
|
+
;
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### CTE/ROWSET
|
|
324
|
+
|
|
325
|
+
Reusable virtual set of rows. Useful for windows, filtering.
|
|
326
|
+
|
|
327
|
+
```sql
|
|
328
|
+
with <alias> as
|
|
329
|
+
select
|
|
330
|
+
<concept>,
|
|
331
|
+
<concept>+1 -> <alias>
|
|
332
|
+
WHERE
|
|
333
|
+
<concept> = <value>
|
|
334
|
+
|
|
335
|
+
select <alias>.<concept>;
|
|
336
|
+
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
#### PERSIST
|
|
341
|
+
|
|
342
|
+
Store output of a query in a warehouse table
|
|
343
|
+
|
|
344
|
+
```sql
|
|
345
|
+
persist <alias> as <table_name> from
|
|
346
|
+
<select>;
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
#### SHOW
|
|
350
|
+
|
|
351
|
+
Return generated SQL without executing.
|
|
352
|
+
|
|
353
|
+
```sql
|
|
354
|
+
show <select>;
|
|
355
|
+
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
trilogy/__init__.py,sha256=
|
|
1
|
+
trilogy/__init__.py,sha256=ouq-RNu0DVYw8n1C2ekRmcAJ_SL_PFzbRBzo2O814TM,292
|
|
2
2
|
trilogy/compiler.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
trilogy/constants.py,sha256=LxiK2TiVQPEa6tXkxWk9DJHOR3zsGNSqgQuqtOf66cw,518
|
|
4
4
|
trilogy/engine.py,sha256=R5ubIxYyrxRExz07aZCUfrTsoXCHQ8DKFTDsobXdWdA,1102
|
|
@@ -16,7 +16,7 @@ trilogy/core/exceptions.py,sha256=NvV_4qLOgKXbpotgRf7c8BANDEvHxlqRPaA53IThQ2o,56
|
|
|
16
16
|
trilogy/core/functions.py,sha256=zkRReytiotOBAW-a3Ri5eoejZDYTt2-7Op80ZxZxUmw,9129
|
|
17
17
|
trilogy/core/graph_models.py,sha256=oJUMSpmYhqXlavckHLpR07GJxuQ8dZ1VbB1fB0KaS8c,2036
|
|
18
18
|
trilogy/core/internal.py,sha256=jNGFHKENnbMiMCtAgsnLZYVSENDK4b5ALecXFZpTDzQ,1075
|
|
19
|
-
trilogy/core/models.py,sha256=
|
|
19
|
+
trilogy/core/models.py,sha256=WH7GHgn1a3xegVo12_NTP7V_ptN-_ObY7s4ZgkPI0D4,108548
|
|
20
20
|
trilogy/core/optimization.py,sha256=SpWRQL1biAUvMCijk2I-FCQY2KzXd4eiu3ZlxzVE-uQ,4505
|
|
21
21
|
trilogy/core/query_processor.py,sha256=w_CS2TEmSk8Bhk6ukxLavQgQyA9UwcgoPChouLREujQ,11747
|
|
22
22
|
trilogy/core/processing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -45,8 +45,8 @@ trilogy/core/processing/nodes/select_node_v2.py,sha256=tAADeVruch-flFiedbY1zi7uk
|
|
|
45
45
|
trilogy/core/processing/nodes/unnest_node.py,sha256=t4kY3a_dR3iXistPemStfdw0uJfnxwTcoQg1HiDa3xo,1501
|
|
46
46
|
trilogy/core/processing/nodes/window_node.py,sha256=QjAWgqBZqFSRCPwc7JBmgQJobWW50rsHI0pjJe0Zzg0,926
|
|
47
47
|
trilogy/dialect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
trilogy/dialect/base.py,sha256=
|
|
49
|
-
trilogy/dialect/bigquery.py,sha256=
|
|
48
|
+
trilogy/dialect/base.py,sha256=nYrm7Z-GnVVhr5vWHjMghWkGoq2r7ogzoGVasAGTxGo,29223
|
|
49
|
+
trilogy/dialect/bigquery.py,sha256=9vxQn2BMv_oTGQSWQpoN5ho_OgqMWaHH9e-5vQVf44c,2906
|
|
50
50
|
trilogy/dialect/common.py,sha256=zWrYmvevlXznocw9uGHmY5Ws1rp_kICm9zA_ulTe4eg,2165
|
|
51
51
|
trilogy/dialect/config.py,sha256=JdGIiHf2EVoFNTYzqQUy1bMmzqZiFTjcnYglzAMa4dM,3351
|
|
52
52
|
trilogy/dialect/duckdb.py,sha256=Ddyt68sr8IL2HnZMenyytoD65FXwY_O2pz1McyS0bis,3075
|
|
@@ -70,9 +70,9 @@ trilogy/parsing/parse_engine.py,sha256=TLy56pDatDfzfwbJkrJ-XXB05s_VW9_iRrkwtKR0G
|
|
|
70
70
|
trilogy/parsing/render.py,sha256=fxjpq2FZLgllw_d4cru-t_IXNPAz2DmYkT7v9ED0XRI,11540
|
|
71
71
|
trilogy/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
72
72
|
trilogy/scripts/trilogy.py,sha256=PHxvv6f2ODv0esyyhWxlARgra8dVhqQhYl0lTrSyVNo,3729
|
|
73
|
-
pytrilogy-0.0.1.
|
|
74
|
-
pytrilogy-0.0.1.
|
|
75
|
-
pytrilogy-0.0.1.
|
|
76
|
-
pytrilogy-0.0.1.
|
|
77
|
-
pytrilogy-0.0.1.
|
|
78
|
-
pytrilogy-0.0.1.
|
|
73
|
+
pytrilogy-0.0.1.107.dist-info/LICENSE.md,sha256=5ZRvtTyCCFwz1THxDTjAu3Lidds9WjPvvzgVwPSYNDo,1042
|
|
74
|
+
pytrilogy-0.0.1.107.dist-info/METADATA,sha256=KF68qL9kNj855oUEtUVCCMd5hei-LRfABfoaEWlTa8g,7882
|
|
75
|
+
pytrilogy-0.0.1.107.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91
|
|
76
|
+
pytrilogy-0.0.1.107.dist-info/entry_points.txt,sha256=0petKryjvvtEfTlbZC1AuMFumH_WQ9v8A19LvoS6G6c,54
|
|
77
|
+
pytrilogy-0.0.1.107.dist-info/top_level.txt,sha256=cAy__NW_eMAa_yT9UnUNlZLFfxcg6eimUAZ184cdNiE,8
|
|
78
|
+
pytrilogy-0.0.1.107.dist-info/RECORD,,
|
trilogy/__init__.py
CHANGED
trilogy/core/models.py
CHANGED
|
@@ -1669,7 +1669,7 @@ class Datasource(Namespaced, BaseModel):
|
|
|
1669
1669
|
namespace = self.namespace.replace(".", "_") if self.namespace else ""
|
|
1670
1670
|
return f"{namespace}_{self.identifier}"
|
|
1671
1671
|
|
|
1672
|
-
@
|
|
1672
|
+
@property
|
|
1673
1673
|
def safe_location(self) -> str:
|
|
1674
1674
|
if isinstance(self.address, Address):
|
|
1675
1675
|
return self.address.location
|
trilogy/dialect/base.py
CHANGED
|
@@ -229,11 +229,11 @@ def safe_get_cte_value(coalesce, cte: CTE, c: Concept, quote_char: str):
|
|
|
229
229
|
return INVALID_REFERENCE_STRING("Missing source reference")
|
|
230
230
|
if isinstance(raw, str):
|
|
231
231
|
rendered = cte.get_alias(c, raw)
|
|
232
|
-
return f"{raw}.{
|
|
232
|
+
return f"{raw}.{safe_quote(rendered, quote_char)}"
|
|
233
233
|
if isinstance(raw, list) and len(raw) == 1:
|
|
234
234
|
rendered = cte.get_alias(c, raw[0])
|
|
235
|
-
return f"{raw[0]}.{
|
|
236
|
-
return coalesce([f"{x}.{
|
|
235
|
+
return f"{raw[0]}.{safe_quote(rendered, quote_char)}"
|
|
236
|
+
return coalesce([f"{x}.{safe_quote(cte.get_alias(c, x), quote_char)}" for x in raw])
|
|
237
237
|
|
|
238
238
|
|
|
239
239
|
class BaseDialect:
|
trilogy/dialect/bigquery.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|