pytrilogy 0.0.1.106__tar.gz → 0.0.1.107__tar.gz

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.

Files changed (100) hide show
  1. {pytrilogy-0.0.1.106/pytrilogy.egg-info → pytrilogy-0.0.1.107}/PKG-INFO +79 -1
  2. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/README.md +78 -0
  3. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107/pytrilogy.egg-info}/PKG-INFO +79 -1
  4. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/__init__.py +1 -1
  5. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/models.py +1 -1
  6. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/dialect/base.py +3 -3
  7. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/dialect/bigquery.py +1 -1
  8. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/LICENSE.md +0 -0
  9. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/pyproject.toml +0 -0
  10. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/pytrilogy.egg-info/SOURCES.txt +0 -0
  11. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/pytrilogy.egg-info/dependency_links.txt +0 -0
  12. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/pytrilogy.egg-info/entry_points.txt +0 -0
  13. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/pytrilogy.egg-info/requires.txt +0 -0
  14. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/pytrilogy.egg-info/top_level.txt +0 -0
  15. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/setup.cfg +0 -0
  16. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/setup.py +0 -0
  17. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_declarations.py +0 -0
  18. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_derived_concepts.py +0 -0
  19. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_discovery_nodes.py +0 -0
  20. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_environment.py +0 -0
  21. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_functions.py +0 -0
  22. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_imports.py +0 -0
  23. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_metadata.py +0 -0
  24. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_models.py +0 -0
  25. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_multi_join_assignments.py +0 -0
  26. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_parsing.py +0 -0
  27. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_partial_handling.py +0 -0
  28. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_query_processing.py +0 -0
  29. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_select.py +0 -0
  30. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_statements.py +0 -0
  31. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_undefined_concept.py +0 -0
  32. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/tests/test_where_clause.py +0 -0
  33. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/compiler.py +0 -0
  34. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/constants.py +0 -0
  35. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/__init__.py +0 -0
  36. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/constants.py +0 -0
  37. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/enums.py +0 -0
  38. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/env_processor.py +0 -0
  39. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/environment_helpers.py +0 -0
  40. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/ergonomics.py +0 -0
  41. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/exceptions.py +0 -0
  42. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/functions.py +0 -0
  43. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/graph_models.py +0 -0
  44. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/internal.py +0 -0
  45. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/optimization.py +0 -0
  46. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/__init__.py +0 -0
  47. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/concept_strategies_v3.py +0 -0
  48. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/graph_utils.py +0 -0
  49. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/__init__.py +0 -0
  50. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/basic_node.py +0 -0
  51. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/common.py +0 -0
  52. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/concept_merge.py +0 -0
  53. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/filter_node.py +0 -0
  54. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/group_node.py +0 -0
  55. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/group_to_node.py +0 -0
  56. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/merge_node.py +0 -0
  57. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/multiselect_node.py +0 -0
  58. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/rowset_node.py +0 -0
  59. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/select_node.py +0 -0
  60. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/unnest_node.py +0 -0
  61. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/node_generators/window_node.py +0 -0
  62. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/nodes/__init__.py +0 -0
  63. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/nodes/base_node.py +0 -0
  64. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/nodes/filter_node.py +0 -0
  65. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/nodes/group_node.py +0 -0
  66. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/nodes/merge_node.py +0 -0
  67. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/nodes/select_node_v2.py +0 -0
  68. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/nodes/unnest_node.py +0 -0
  69. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/nodes/window_node.py +0 -0
  70. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/processing/utility.py +0 -0
  71. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/core/query_processor.py +0 -0
  72. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/dialect/__init__.py +0 -0
  73. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/dialect/common.py +0 -0
  74. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/dialect/config.py +0 -0
  75. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/dialect/duckdb.py +0 -0
  76. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/dialect/enums.py +0 -0
  77. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/dialect/postgres.py +0 -0
  78. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/dialect/presto.py +0 -0
  79. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/dialect/snowflake.py +0 -0
  80. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/dialect/sql_server.py +0 -0
  81. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/docs/__init__.py +0 -0
  82. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/engine.py +0 -0
  83. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/executor.py +0 -0
  84. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/hooks/__init__.py +0 -0
  85. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/hooks/base_hook.py +0 -0
  86. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/hooks/graph_hook.py +0 -0
  87. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/hooks/query_debugger.py +0 -0
  88. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/metadata/__init__.py +0 -0
  89. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/parser.py +0 -0
  90. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/parsing/__init__.py +0 -0
  91. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/parsing/common.py +0 -0
  92. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/parsing/config.py +0 -0
  93. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/parsing/exceptions.py +0 -0
  94. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/parsing/helpers.py +0 -0
  95. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/parsing/parse_engine.py +0 -0
  96. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/parsing/render.py +0 -0
  97. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/py.typed +0 -0
  98. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/scripts/__init__.py +0 -0
  99. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/scripts/trilogy.py +0 -0
  100. {pytrilogy-0.0.1.106 → pytrilogy-0.0.1.107}/trilogy/utility.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytrilogy
3
- Version: 0.0.1.106
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
+ ```
@@ -246,3 +246,81 @@ but all are worth checking out. Please open PRs/comment for anything missed!
246
246
  - [malloy](https://github.com/malloydata/malloy)
247
247
  - [preql](https://github.com/erezsh/Preql)
248
248
  - [PREQL](https://github.com/PRQL/prql)
249
+
250
+ ## Minimal Syntax Reference
251
+
252
+ #### IMPORT
253
+
254
+ `import <path> as <alias>;`
255
+
256
+ #### CONCEPT
257
+
258
+ Types: `string | int | float | bool | date | datetime | time | timestamp | interval`;
259
+
260
+ Key:
261
+ `key <name> <type>;`
262
+
263
+ Property:
264
+ `property <key>.<name> <type>;`
265
+
266
+ Transformation:
267
+ `auto <name> <- <expression>;`
268
+
269
+ #### DATASOURCE
270
+ ```sql
271
+ datasource <name>(
272
+ <column>:<concept>,
273
+ <column>:<concept>,
274
+ )
275
+ grain(<concept>, <concept>)
276
+ address <table>;
277
+ ```
278
+
279
+ #### SELECT
280
+
281
+ Primary acces
282
+
283
+ ```sql
284
+ select
285
+ <concept>,
286
+ <concept>+1 -> <alias>
287
+ WHERE
288
+ <concept> = <value>
289
+ ORDER BY
290
+ <concept> asc|desc
291
+ ;
292
+ ```
293
+
294
+ #### CTE/ROWSET
295
+
296
+ Reusable virtual set of rows. Useful for windows, filtering.
297
+
298
+ ```sql
299
+ with <alias> as
300
+ select
301
+ <concept>,
302
+ <concept>+1 -> <alias>
303
+ WHERE
304
+ <concept> = <value>
305
+
306
+ select <alias>.<concept>;
307
+
308
+ ```
309
+
310
+
311
+ #### PERSIST
312
+
313
+ Store output of a query in a warehouse table
314
+
315
+ ```sql
316
+ persist <alias> as <table_name> from
317
+ <select>;
318
+ ```
319
+
320
+ #### SHOW
321
+
322
+ Return generated SQL without executing.
323
+
324
+ ```sql
325
+ show <select>;
326
+ ```
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pytrilogy
3
- Version: 0.0.1.106
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
+ ```
@@ -4,6 +4,6 @@ from trilogy.executor import Executor
4
4
  from trilogy.parser import parse
5
5
  from trilogy.constants import CONFIG
6
6
 
7
- __version__ = "0.0.1.106"
7
+ __version__ = "0.0.1.107"
8
8
 
9
9
  __all__ = ["parse", "Executor", "Dialects", "Environment", "CONFIG"]
@@ -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
- @cached_property
1672
+ @property
1673
1673
  def safe_location(self) -> str:
1674
1674
  if isinstance(self.address, Address):
1675
1675
  return self.address.location
@@ -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}.{quote_char}{rendered}{quote_char}"
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]}.{quote_char}{rendered}{quote_char}"
236
- return coalesce([f"{x}.{quote_char}{cte.get_alias(c, x)}{quote_char}" for x in raw])
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:
@@ -45,7 +45,7 @@ WITH {% for cte in ctes %}
45
45
  {{cte.name}} as ({{cte.statement}}){% if not loop.last %},{% endif %}{% endfor %}{% endif %}
46
46
  {%- if full_select -%}
47
47
  {{full_select}}
48
- {%- else -%}
48
+ {% else -%}
49
49
 
50
50
  SELECT
51
51
  {%- for select in select_columns %}
File without changes
File without changes
File without changes