relationalai 1.0.0a2__py3-none-any.whl → 1.0.0a3__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.
- relationalai/shims/executor.py +4 -1
- relationalai/shims/mm2v0.py +15 -10
- {relationalai-1.0.0a2.dist-info → relationalai-1.0.0a3.dist-info}/METADATA +1 -1
- {relationalai-1.0.0a2.dist-info → relationalai-1.0.0a3.dist-info}/RECORD +39 -30
- v0/relationalai/__init__.py +69 -22
- v0/relationalai/clients/__init__.py +15 -2
- v0/relationalai/clients/client.py +4 -4
- v0/relationalai/clients/local.py +5 -5
- v0/relationalai/clients/resources/__init__.py +8 -0
- v0/relationalai/clients/{azure.py → resources/azure/azure.py} +12 -12
- v0/relationalai/clients/resources/snowflake/__init__.py +20 -0
- v0/relationalai/clients/resources/snowflake/cli_resources.py +87 -0
- v0/relationalai/clients/resources/snowflake/direct_access_resources.py +711 -0
- v0/relationalai/clients/resources/snowflake/engine_state_handlers.py +309 -0
- v0/relationalai/clients/resources/snowflake/error_handlers.py +199 -0
- v0/relationalai/clients/resources/snowflake/resources_factory.py +99 -0
- v0/relationalai/clients/{snowflake.py → resources/snowflake/snowflake.py} +606 -1392
- v0/relationalai/clients/{use_index_poller.py → resources/snowflake/use_index_poller.py} +43 -12
- v0/relationalai/clients/resources/snowflake/use_index_resources.py +188 -0
- v0/relationalai/clients/resources/snowflake/util.py +387 -0
- v0/relationalai/early_access/dsl/ir/executor.py +4 -4
- v0/relationalai/early_access/dsl/snow/api.py +2 -1
- v0/relationalai/experimental/solvers.py +7 -7
- v0/relationalai/semantics/devtools/benchmark_lqp.py +4 -5
- v0/relationalai/semantics/devtools/extract_lqp.py +1 -1
- v0/relationalai/semantics/internal/snowflake.py +1 -1
- v0/relationalai/semantics/lqp/executor.py +4 -11
- v0/relationalai/semantics/metamodel/util.py +6 -5
- v0/relationalai/semantics/rel/executor.py +14 -11
- v0/relationalai/semantics/sql/executor/snowflake.py +9 -5
- v0/relationalai/semantics/tests/test_snapshot_abstract.py +1 -1
- v0/relationalai/tools/cli.py +26 -30
- v0/relationalai/tools/cli_helpers.py +10 -2
- v0/relationalai/util/otel_configuration.py +2 -1
- v0/relationalai/util/otel_handler.py +1 -1
- {relationalai-1.0.0a2.dist-info → relationalai-1.0.0a3.dist-info}/WHEEL +0 -0
- {relationalai-1.0.0a2.dist-info → relationalai-1.0.0a3.dist-info}/entry_points.txt +0 -0
- {relationalai-1.0.0a2.dist-info → relationalai-1.0.0a3.dist-info}/top_level.txt +0 -0
- /v0/relationalai/clients/{cache_store.py → resources/snowflake/cache_store.py} +0 -0
relationalai/shims/executor.py
CHANGED
|
@@ -10,7 +10,10 @@ from v0.relationalai.semantics.rel.executor import RelExecutor
|
|
|
10
10
|
from v0.relationalai.semantics.metamodel import ir as v0, factory as v0_factory
|
|
11
11
|
from v0.relationalai.semantics.metamodel.visitor import collect_by_type
|
|
12
12
|
from v0.relationalai.semantics.snowflake import Table as v0Table
|
|
13
|
-
|
|
13
|
+
try:
|
|
14
|
+
from v0.relationalai.clients.snowflake import Provider as v0Provider #type: ignore
|
|
15
|
+
except ImportError:
|
|
16
|
+
from v0.relationalai.clients.resources.snowflake import Provider as v0Provider
|
|
14
17
|
from v0.relationalai.clients.config import Config
|
|
15
18
|
|
|
16
19
|
# from ..config import Config
|
relationalai/shims/mm2v0.py
CHANGED
|
@@ -456,6 +456,17 @@ class Translator():
|
|
|
456
456
|
def translate_table(self, t: mm.Table, parent, ctx):
|
|
457
457
|
return self.translate_scalartype(t, parent, ctx)
|
|
458
458
|
|
|
459
|
+
def rewrite_cdc_args(self, l: mm.Lookup, args, parent, ctx):
|
|
460
|
+
# If this is a lookup for an external table column,
|
|
461
|
+
# we have to prepend the column symbol to the args
|
|
462
|
+
root_type = l.relation.fields[0].type
|
|
463
|
+
if isinstance(root_type, mm.Table):
|
|
464
|
+
self.used_tables.add(root_type)
|
|
465
|
+
is_table = l.relation == root_type
|
|
466
|
+
if is_table or l.relation in root_type.columns:
|
|
467
|
+
sym = "METADATA$KEY" if is_table else l.relation.name
|
|
468
|
+
args = (v0.Literal(type=v0_types.Symbol, value=sym), *args)
|
|
469
|
+
return args
|
|
459
470
|
|
|
460
471
|
# -----------------------------------------------------------------------------
|
|
461
472
|
# Values
|
|
@@ -851,19 +862,11 @@ class Translator():
|
|
|
851
862
|
if relation is None:
|
|
852
863
|
return None
|
|
853
864
|
|
|
854
|
-
# External Table Column lookups
|
|
855
|
-
# we have to prepend the column symbol to the args
|
|
856
|
-
root_type = l.relation.fields[0].type
|
|
857
|
-
if isinstance(root_type, mm.Table):
|
|
858
|
-
self.used_tables.add(root_type)
|
|
859
|
-
is_table = l.relation == root_type
|
|
860
|
-
if is_table or l.relation in root_type.columns:
|
|
861
|
-
sym = "METADATA$KEY" if is_table else l.relation.name
|
|
862
|
-
args = (v0.Literal(type=v0_types.Symbol, value=sym), *args)
|
|
863
865
|
|
|
864
866
|
# Specific rewrites
|
|
865
867
|
rewrite = self.rewrite_lookup(l, parent, ctx)
|
|
866
868
|
if rewrite is None:
|
|
869
|
+
args = self.rewrite_cdc_args(l, args, parent, ctx)
|
|
867
870
|
# General translation
|
|
868
871
|
rewrite = v0.Lookup(
|
|
869
872
|
engine=self.translate_reasoner(l.reasoner, l, Context.MODEL),
|
|
@@ -1100,10 +1103,12 @@ class Translator():
|
|
|
1100
1103
|
else:
|
|
1101
1104
|
replaced_args.append(arg)
|
|
1102
1105
|
# translate the lookup
|
|
1106
|
+
args = tuple(self.translate_value(arg, l, ctx) for arg in replaced_args)
|
|
1107
|
+
args = self.rewrite_cdc_args(l, args, l, ctx)
|
|
1103
1108
|
lookup = v0.Lookup(
|
|
1104
1109
|
engine=self.translate_reasoner(l.reasoner, l, Context.MODEL),
|
|
1105
1110
|
relation=self.translate_node(l.relation), # type: ignore
|
|
1106
|
-
args=
|
|
1111
|
+
args=args,
|
|
1107
1112
|
annotations=self.translate_frozen(l.annotations, l, ctx) # type: ignore
|
|
1108
1113
|
)
|
|
1109
1114
|
# subtract 1 from the index to convert from 1-based to 0-based
|
|
@@ -42,10 +42,10 @@ relationalai/semantics/std/numbers.py,sha256=AcmESbBXIQDkDL6YGZXYKmpo7uyYD1or7su
|
|
|
42
42
|
relationalai/semantics/std/re.py,sha256=xMuQY5sG3fEL1efHDNFnVpnXVkDJMmDVUEbHiPr1oqA,4375
|
|
43
43
|
relationalai/semantics/std/strings.py,sha256=w0k06gDfyMS6GODPjhG0gl2SkJ0aH5aYezS8jG9jsU8,5617
|
|
44
44
|
relationalai/shims/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
45
|
-
relationalai/shims/executor.py,sha256=
|
|
45
|
+
relationalai/shims/executor.py,sha256=LtpBx74mhbJ1bCUVvetDlk5iDAEi_x-wNZ6iq5WPW2s,7531
|
|
46
46
|
relationalai/shims/helpers.py,sha256=1v6D-wDq3nCwDz4egdGUeleRC0fK6wfo9fIQIeQCfZA,4508
|
|
47
47
|
relationalai/shims/hoister.py,sha256=YXXi9pWpKQ7Sd5DzRVl_78z4OYCoKzFfIMMp6OIN3EM,8797
|
|
48
|
-
relationalai/shims/mm2v0.py,sha256=
|
|
48
|
+
relationalai/shims/mm2v0.py,sha256=_fqEfd6b3sVwmkuozfggoopRdNeqbsrtJgj8b9Teij8,63957
|
|
49
49
|
relationalai/tools/debugger.py,sha256=B8QIE1-WFdfkiPoFFn1yztr9t6yf5PI32Y9Y9XzQOJk,10798
|
|
50
50
|
relationalai/tools/typer_debugger.py,sha256=__oLODEBwgt6pYIn1jgIPlenFmiK7iqXfTY_mozHxXA,3182
|
|
51
51
|
relationalai/tools/cli/__init__.py,sha256=jkIlp7wftUuSIlczwZD4_siT5cs6mzpsNGrQ_kMkLZ4,74
|
|
@@ -66,7 +66,7 @@ relationalai/util/schema.py,sha256=8pzpI4eMg1W4rsyBZtrU_AzCuBxNx4m_cX_XR1BFjCI,6
|
|
|
66
66
|
relationalai/util/source.py,sha256=k49NhkCDST4Wa_1xJnEsfG2JZIdADlqzqvHt4FCYfq4,6645
|
|
67
67
|
relationalai/util/structures.py,sha256=3QxHkgJSy9oPom6eJX2z1O3pJugINqD5DUjXwoCWwRg,4990
|
|
68
68
|
relationalai/util/tracing.py,sha256=peOVe55R3B9gVdXAsVPGZ7_jw0KvYlkito-_5zERYtg,9632
|
|
69
|
-
v0/relationalai/__init__.py,sha256=
|
|
69
|
+
v0/relationalai/__init__.py,sha256=IcozhVGyoDvBaLAbCgGxJ7JBDbgsMhNkEgVzJ2rZFVY,10464
|
|
70
70
|
v0/relationalai/compiler.py,sha256=5LZY8AyqadkTLSe_xoJ3J9iXOmetz5YQn9EjJKk8XeQ,6411
|
|
71
71
|
v0/relationalai/debugging.py,sha256=AuzbwLT1s71tctuIbYNhfWY2vR_opB7ItbmlqFVHgrY,12024
|
|
72
72
|
v0/relationalai/dependencies.py,sha256=tL113efcISkJUiDXYHmRdU_usdD7gmee-VRHA7N4EFA,16574
|
|
@@ -86,20 +86,29 @@ v0/relationalai/auth/jwt_generator.py,sha256=bQY2-EhvKcidamWB4tiRO8VVl_5bH0GC9Y6
|
|
|
86
86
|
v0/relationalai/auth/oauth_callback_server.py,sha256=vbcpz77n_WKMDZ4sac6IYyrpxScR0DHlf5VFHMwjHGg,3908
|
|
87
87
|
v0/relationalai/auth/token_handler.py,sha256=d5aueGEiK6BmzkxSab3reCdkhtjdphb0CeecyvvNaQU,19443
|
|
88
88
|
v0/relationalai/auth/util.py,sha256=oXOUwW5gaBhEV5v5A-q2ME1VnfjfRWswvRlXW4oBYpk,1116
|
|
89
|
-
v0/relationalai/clients/__init__.py,sha256
|
|
90
|
-
v0/relationalai/clients/
|
|
91
|
-
v0/relationalai/clients/cache_store.py,sha256=A-qd11wcwN3TkIqvlN0_iFUU3aEjJal3T2pqFBwkkzQ,3966
|
|
92
|
-
v0/relationalai/clients/client.py,sha256=46_fu8xKR5m6HnTeI9UhIEZtojPrsc-3hMhTutObzxY,35798
|
|
89
|
+
v0/relationalai/clients/__init__.py,sha256=LQ_yHsutRMpoW2mOTmOPGF8mrbP0OiV5E68t8uVwDyQ,833
|
|
90
|
+
v0/relationalai/clients/client.py,sha256=gk_V9KS7_MM2dLL2OCO7EPLHD9dsRwR6R-30SW8lDwU,35759
|
|
93
91
|
v0/relationalai/clients/config.py,sha256=PriDlD0_VZFV0fEQng6U-F5xjGwz5gC2F5_lM159AjM,24481
|
|
94
92
|
v0/relationalai/clients/direct_access_client.py,sha256=p3hqjwdiXQQytRke1wIeNRM-HlZLAxH1U6-yPhsPOdQ,6454
|
|
95
93
|
v0/relationalai/clients/hash_util.py,sha256=NXVtUFgRokZz-45CwV-r5Z5KvmEXD2dh4ypNOrEWAwY,1501
|
|
96
|
-
v0/relationalai/clients/local.py,sha256=
|
|
94
|
+
v0/relationalai/clients/local.py,sha256=vo5ikSWg38l3xQAh9yL--4sMAj_T5Tn7YEZiw7TCH08,23504
|
|
97
95
|
v0/relationalai/clients/profile_polling.py,sha256=c1ixxAOKvy-dDfVqkKENwfcsvBB8jhLA1oT9RIFIrY8,2571
|
|
98
96
|
v0/relationalai/clients/result_helpers.py,sha256=dgj4mVg7ZsFsVppI98VQjNMdDEBXuBF7BnyNozidmeY,17817
|
|
99
|
-
v0/relationalai/clients/snowflake.py,sha256=xAyCYWfDE0n7MGdwFBfhVg248QaDzxaKArAObJe0Gho,168282
|
|
100
97
|
v0/relationalai/clients/types.py,sha256=VU2LRtlnFsBRYdokxUccrsUkEYLE9N62EUiWtA_qdYc,2893
|
|
101
|
-
v0/relationalai/clients/use_index_poller.py,sha256=34KQyNr_TL85hWsd803R0D_Ms4P6grQhOr5KSXDyszs,46830
|
|
102
98
|
v0/relationalai/clients/util.py,sha256=Vrw_kr-Oqp_DKTkJ_rTbzpDm4_Z4h8w10T8GUyGLxbA,12323
|
|
99
|
+
v0/relationalai/clients/resources/__init__.py,sha256=pymn8gB86Q3C2bVoFei0KAL8pX_U04uDY9TE4TKzTBs,260
|
|
100
|
+
v0/relationalai/clients/resources/azure/azure.py,sha256=TDapfM5rLoHrPrXg5cUe827m3AO0gSqQjNid1VUlUFo,20631
|
|
101
|
+
v0/relationalai/clients/resources/snowflake/__init__.py,sha256=9VR-hSIw4ZSEWisKcWhNEcRVBmBfueXNCTOOfLt-8rs,871
|
|
102
|
+
v0/relationalai/clients/resources/snowflake/cache_store.py,sha256=A-qd11wcwN3TkIqvlN0_iFUU3aEjJal3T2pqFBwkkzQ,3966
|
|
103
|
+
v0/relationalai/clients/resources/snowflake/cli_resources.py,sha256=xTIcCzvgbkxuNAEvzZoRpj0n-js0hZCK30q7IZXztbI,3252
|
|
104
|
+
v0/relationalai/clients/resources/snowflake/direct_access_resources.py,sha256=Xvh1e6TxUW2dTSS-9HadrfWVKrxNQ5GikqM4yjohJkM,29849
|
|
105
|
+
v0/relationalai/clients/resources/snowflake/engine_state_handlers.py,sha256=SQBu4GfbyABU6xrEV-koivC-ubsVrfCBTF0FEQgJM5g,12054
|
|
106
|
+
v0/relationalai/clients/resources/snowflake/error_handlers.py,sha256=581G2xOihUoiPlucC_Z2FOzhKu_swdIc3uORd0yJQuA,8805
|
|
107
|
+
v0/relationalai/clients/resources/snowflake/resources_factory.py,sha256=4LGd4IQ6z8hGeGlO1TIjSFJEeUNHutaB7j9q1a9rYfQ,3385
|
|
108
|
+
v0/relationalai/clients/resources/snowflake/snowflake.py,sha256=UiSE2jbJVGbe2_UfLI9Gud9aA5SJysuVu3F0McOz95k,133046
|
|
109
|
+
v0/relationalai/clients/resources/snowflake/use_index_poller.py,sha256=4lPMgaeuxUdWo-ds_78OJpc7pyogWhSVgGzuTzj13wE,48460
|
|
110
|
+
v0/relationalai/clients/resources/snowflake/use_index_resources.py,sha256=69PNWHI_uf-Aw_evfwC6j8HLVdjhp84vs8hLkjnhwbg,6462
|
|
111
|
+
v0/relationalai/clients/resources/snowflake/util.py,sha256=BEnm1B1-nqqHdm41RNxblbb-zqXbtqEGGZmTdAYeN_M,13841
|
|
103
112
|
v0/relationalai/early_access/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
104
113
|
v0/relationalai/early_access/builder/__init__.py,sha256=h2zZSEF6xcuk0Ysy8CRzF172usliAs9VUW5t6P3rOBw,996
|
|
105
114
|
v0/relationalai/early_access/builder/builder/__init__.py,sha256=0nUNYRT0QdAlBU0S7aovypHQBdBrBHumr3Ps_gG3R_E,1468
|
|
@@ -176,7 +185,7 @@ v0/relationalai/early_access/dsl/core/types/constrained/nominal.py,sha256=jfpqGs
|
|
|
176
185
|
v0/relationalai/early_access/dsl/core/types/constrained/subtype.py,sha256=qODz36SaWywRHALQLy1d2V8gPqHfb6F357ShRrbacJA,4311
|
|
177
186
|
v0/relationalai/early_access/dsl/ir/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
178
187
|
v0/relationalai/early_access/dsl/ir/compiler.py,sha256=W_hLa6FoqfF140G01aq6qpYtfpxVZRsxS37Ss7N2mUY,15313
|
|
179
|
-
v0/relationalai/early_access/dsl/ir/executor.py,sha256=
|
|
188
|
+
v0/relationalai/early_access/dsl/ir/executor.py,sha256=RSuFpgvkV7ILdE3krUNOHg0ZplpHKlQlbV6GWCAR1d4,12241
|
|
180
189
|
v0/relationalai/early_access/dsl/ontologies/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
181
190
|
v0/relationalai/early_access/dsl/ontologies/constraints.py,sha256=do7IR0sN9S5mBEf79adtmZq-RkOc3HNg9Q1ZbXjlAsY,2429
|
|
182
191
|
v0/relationalai/early_access/dsl/ontologies/export.py,sha256=wyDUjwQ9TwCFKwN8m9S-7G4kKaI5dk4nvecbCy-W5Hc,999
|
|
@@ -219,7 +228,7 @@ v0/relationalai/early_access/dsl/serialize/binding_model.py,sha256=RvfUUnTjjmtWw
|
|
|
219
228
|
v0/relationalai/early_access/dsl/serialize/exporter.py,sha256=oXBxSjHvms7bzIHYb_dU1ItOchbjpDiSjkhXRD-oF2c,8024
|
|
220
229
|
v0/relationalai/early_access/dsl/serialize/model.py,sha256=bIzNuw5hV4iPyUZIPTWdG6BevAtl9RnhNW_cymSk7zU,2378
|
|
221
230
|
v0/relationalai/early_access/dsl/snow/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
222
|
-
v0/relationalai/early_access/dsl/snow/api.py,sha256=
|
|
231
|
+
v0/relationalai/early_access/dsl/snow/api.py,sha256=NyOPLanXZaqtINOo9e7M-tdu2Jlo9KFw2G7mYrAKMes,4375
|
|
223
232
|
v0/relationalai/early_access/dsl/snow/common.py,sha256=i8L-TXw1RLUVB9NK8LpFkQAkUquIkbdh1nU0ePsGkCA,2172
|
|
224
233
|
v0/relationalai/early_access/dsl/state_mgmt/__init__.py,sha256=W0hzq5Oa2yy9YoQfC5Ru5UqggyzIhsryljmVt_NCkKQ,4339
|
|
225
234
|
v0/relationalai/early_access/dsl/state_mgmt/state_charts.py,sha256=zBQS9vdEYx5iRSLbp31k4xz8HFDp2EMKTgVQfzaPQlM,4054
|
|
@@ -279,7 +288,7 @@ v0/relationalai/experimental/SF.py,sha256=ER6NFB_Vo6hjxdwgDFshFMx_huCwhqOYfEqzFn
|
|
|
279
288
|
v0/relationalai/experimental/__init__.py,sha256=alaOJulJ9YHRl4WGyQ3Kzxhrpc2gP542oNheWXzs7NQ,74
|
|
280
289
|
v0/relationalai/experimental/graphs.py,sha256=vJQ_8ZF_Q2pL-w1xI4O22VGqbnTDimkkqTNqqIkGL7c,3521
|
|
281
290
|
v0/relationalai/experimental/inspect.py,sha256=CkZVzq1MTXf5aOsqHYZaDXYNegW8Er-7Z4NAJqT9QWM,1650
|
|
282
|
-
v0/relationalai/experimental/solvers.py,sha256=
|
|
291
|
+
v0/relationalai/experimental/solvers.py,sha256=boZc8DNKTZa-p3AAAtMrYX23nzNSnhw03TlXPm0OO8I,43446
|
|
283
292
|
v0/relationalai/experimental/pathfinder/__init__.py,sha256=GSGTur8UMhhv9u3VmZAWp6OxtDymZRaHDqgV9V2IFuc,5519
|
|
284
293
|
v0/relationalai/experimental/pathfinder/api.py,sha256=iRf9QKq5xIVqiPPQEQGx9BHxbT-dME0kmn5ox6IBCDM,4241
|
|
285
294
|
v0/relationalai/experimental/pathfinder/automaton.py,sha256=y5i3ry_gIPoAp0ZTsCNXTXSutst6VcGCg2VZ5Z_N9Yw,21910
|
|
@@ -352,18 +361,18 @@ v0/relationalai/loaders/loader.py,sha256=SmdV5u8NPvc72eb03sQWDD2nqCNDEsueh8LJ3kL
|
|
|
352
361
|
v0/relationalai/loaders/types.py,sha256=1Fnr-TQc21Vh_Vwrzpmqm7ILr9-lvogOBE0OXGLG7mg,622
|
|
353
362
|
v0/relationalai/semantics/__init__.py,sha256=SnJCjUGj-y9e5-75jxLsiZRM_xLmhOVaZwmgxtscinI,935
|
|
354
363
|
v0/relationalai/semantics/devtools/__init__.py,sha256=hckMw2EtrVBiE71ABXX8bWPdI-6DV9uHqkhYG_nl8S4,85
|
|
355
|
-
v0/relationalai/semantics/devtools/benchmark_lqp.py,sha256=
|
|
364
|
+
v0/relationalai/semantics/devtools/benchmark_lqp.py,sha256=02bMXOYAVYLzi1pYF9qGa9cBV7IH_-VTRNBL76Iq158,21254
|
|
356
365
|
v0/relationalai/semantics/devtools/compilation_manager.py,sha256=DDHY5DNwRK0hD9P8ffBUfrGIG24QI7HDj8XKZulgpog,11181
|
|
357
|
-
v0/relationalai/semantics/devtools/extract_lqp.py,sha256=
|
|
366
|
+
v0/relationalai/semantics/devtools/extract_lqp.py,sha256=R4F718cH2uYHz0lx66JHy-2Qj6QbWfqeR-ApAxyVqvU,3712
|
|
358
367
|
v0/relationalai/semantics/internal/__init__.py,sha256=BS0WE1GbT-HpQ5p_zMr9Fcvph562WMvMQNI9czfKNt0,798
|
|
359
368
|
v0/relationalai/semantics/internal/annotations.py,sha256=PkrRN-gHO2ksh1hDKB1VVIB39dONvLdTd8_Y0rCR3fE,367
|
|
360
369
|
v0/relationalai/semantics/internal/internal.py,sha256=-juUQ8AL1kAoh6PgpBQJ5Jp3qjwSgjx64s3IKeKXVYk,150821
|
|
361
|
-
v0/relationalai/semantics/internal/snowflake.py,sha256=
|
|
370
|
+
v0/relationalai/semantics/internal/snowflake.py,sha256=rQpxtR8BImj_ulTbmN0PIpMz0CvJrcC0-TPrTxCSa3k,13598
|
|
362
371
|
v0/relationalai/semantics/lqp/__init__.py,sha256=XgcQZxK-zz_LqPDVtwREhsIvjTuUIt4BZhIedCeMY-s,48
|
|
363
372
|
v0/relationalai/semantics/lqp/builtins.py,sha256=Xst9-UxkCAwDqL-hFOby8B3GKh705oidFUjEozxn71Y,585
|
|
364
373
|
v0/relationalai/semantics/lqp/compiler.py,sha256=xpGIQAqTMwLi3Vrbe79Yal7O_mfNxpBLioZjqeV2hzc,955
|
|
365
374
|
v0/relationalai/semantics/lqp/constructors.py,sha256=x7G85vbJzLIXzUCMKVdJVsr4PrcUsAOzCCfvimHLMVU,2366
|
|
366
|
-
v0/relationalai/semantics/lqp/executor.py,sha256=
|
|
375
|
+
v0/relationalai/semantics/lqp/executor.py,sha256=3tJVxFsUMdevC-HGYR2BjexC4nBoblUBSf87xlIZ_g0,21469
|
|
367
376
|
v0/relationalai/semantics/lqp/intrinsics.py,sha256=8kgH4ndYKBCNnoNOn7iWOU0wnMTSiov0kYaKocQ45RY,880
|
|
368
377
|
v0/relationalai/semantics/lqp/ir.py,sha256=6W9mUH0W7u5eIfF1S3o33uSOfQuM3UcqEkxrxpr1X_8,1867
|
|
369
378
|
v0/relationalai/semantics/lqp/model2lqp.py,sha256=J_QofcYgq_Yb5dhOOP4lXvxsxFMEGHVnaNXoCMK_ak8,38639
|
|
@@ -393,7 +402,7 @@ v0/relationalai/semantics/metamodel/factory.py,sha256=ECOg7Fg6DJrJDKIzv3TZqhuN4R
|
|
|
393
402
|
v0/relationalai/semantics/metamodel/helpers.py,sha256=G6p6XgqeM9b95D4yUaiq71l5WY40Y1neLgMjqk-ofeU,15409
|
|
394
403
|
v0/relationalai/semantics/metamodel/ir.py,sha256=4Xl3oc92Q7_s33axtrZUXr-GL8VGJsKc7yaSNcO6jXY,33578
|
|
395
404
|
v0/relationalai/semantics/metamodel/types.py,sha256=9ErIkHgsTcPgsoEet-meiftLs4W1MJb-G1H_1EzFfLY,11557
|
|
396
|
-
v0/relationalai/semantics/metamodel/util.py,sha256
|
|
405
|
+
v0/relationalai/semantics/metamodel/util.py,sha256=-_9UMyLvz6bzAI0paXWLWlbqOcPwI9dKopPwEK3ZZhk,16755
|
|
397
406
|
v0/relationalai/semantics/metamodel/visitor.py,sha256=DFY0DACLhxlZ0e4p0vWqbK6ZJr_GWEvH66CU_HVuoTk,35527
|
|
398
407
|
v0/relationalai/semantics/metamodel/rewrite/__init__.py,sha256=9ONWFSdMPHkWpObDMSljt8DywhpFf4Ehsq1aT3fTPt8,344
|
|
399
408
|
v0/relationalai/semantics/metamodel/rewrite/discharge_constraints.py,sha256=jilU6ZNaqhoFRwNdxArSfYb3Rbeahig9kDjdYoJR9Q4,1955
|
|
@@ -415,7 +424,7 @@ v0/relationalai/semantics/reasoners/optimization/solvers_pb.py,sha256=1RobVkhUDP
|
|
|
415
424
|
v0/relationalai/semantics/rel/__init__.py,sha256=pMlVTC_TbQ45mP1LpzwFBBgPxpKc0H3uJDvvDXEWzvs,55
|
|
416
425
|
v0/relationalai/semantics/rel/builtins.py,sha256=0M9r5GQb9CnkkbdhO8Psw9TgiZk5CC3z5RMncUa6uuM,1571
|
|
417
426
|
v0/relationalai/semantics/rel/compiler.py,sha256=t7gitonfRewTk8IQ53DTqPegytwax1jGu43VgQOqBWA,43062
|
|
418
|
-
v0/relationalai/semantics/rel/executor.py,sha256=
|
|
427
|
+
v0/relationalai/semantics/rel/executor.py,sha256=fJnOb6Lgv32Qrr8V72i4M6ebOuEiqqyOcSuffUok3AI,17660
|
|
419
428
|
v0/relationalai/semantics/rel/rel.py,sha256=mQTykcHz63P1w8nhvA8SwYRtIi0LEud19vGrdh0ZrG8,15747
|
|
420
429
|
v0/relationalai/semantics/rel/rel_utils.py,sha256=B9qR7hUouybwluuo9zUYemv6tWPnDPaV4da-emsTrRQ,9569
|
|
421
430
|
v0/relationalai/semantics/snowflake/__init__.py,sha256=QRcuGvnK-TeNOWvHpBu5Z4hJHcMRXb5IPOokvLihy1U,169
|
|
@@ -425,7 +434,7 @@ v0/relationalai/semantics/sql/sql.py,sha256=a3EBJKPp92EoVpl1qct2jdBwXQflFpG1nJ2O
|
|
|
425
434
|
v0/relationalai/semantics/sql/executor/__init__.py,sha256=F3HqQPJVP9wgV3rkwI5jy1_QBCD_3qj2IGxbdT_pX9k,120
|
|
426
435
|
v0/relationalai/semantics/sql/executor/duck_db.py,sha256=FriWhN_IvpQ1YH0YcQ9vlnPRkM1ARoqKDZd0koSk0SM,1918
|
|
427
436
|
v0/relationalai/semantics/sql/executor/result_helpers.py,sha256=WFeijyYXUSl2Ut25SNFYTGZ-XktTlz8CZQt5xm9QW9o,3224
|
|
428
|
-
v0/relationalai/semantics/sql/executor/snowflake.py,sha256=
|
|
437
|
+
v0/relationalai/semantics/sql/executor/snowflake.py,sha256=ItM-dcC-OynlAQNtXTdmVdSyJtKuY24_9_vIXDFP9-A,6024
|
|
429
438
|
v0/relationalai/semantics/sql/rewrite/__init__.py,sha256=AT1WR0rqQHQ7E06NLoVym0zrZpBVPqK85uRFNJUTDp4,254
|
|
430
439
|
v0/relationalai/semantics/sql/rewrite/denormalize.py,sha256=zCwjt8FvcOjs88GUOzLzoqYcxPVlARrYtbVc78yQeBI,9046
|
|
431
440
|
v0/relationalai/semantics/sql/rewrite/double_negation.py,sha256=Rm2-g_gbPPYzqMfsYWX0Z9rm_d-kGVuNRBFNrUaMBbo,1713
|
|
@@ -444,7 +453,7 @@ v0/relationalai/semantics/std/std.py,sha256=T9cPRC19I3WlolDyHk8nwVzGRyyYCpbagN1v
|
|
|
444
453
|
v0/relationalai/semantics/std/strings.py,sha256=3fw1VAggsuFosH_3-5BIB4KbKDmqVque9FlV3yJusrE,2705
|
|
445
454
|
v0/relationalai/semantics/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
446
455
|
v0/relationalai/semantics/tests/logging.py,sha256=oJTrUS_Bq6WxqqO8QLtrjdkUB02Uu5erZ7FTl__-lNY,1432
|
|
447
|
-
v0/relationalai/semantics/tests/test_snapshot_abstract.py,sha256=
|
|
456
|
+
v0/relationalai/semantics/tests/test_snapshot_abstract.py,sha256=Q2rIUhzwVAJMJVoCsBtrCVBYafUR7nTQUxO2bL3ECa8,6336
|
|
448
457
|
v0/relationalai/semantics/tests/test_snapshot_base.py,sha256=Q2zThxDOp2FrXK4uhV4nStBc_Q2-ML6MJ-dfE-e6R7U,469
|
|
449
458
|
v0/relationalai/semantics/tests/utils.py,sha256=qcZ5IgU6_vRdKI9yLuoUkBE0Cq0iU6yzPh5HQaH3ttA,1834
|
|
450
459
|
v0/relationalai/std/__init__.py,sha256=r-o7hYZip7xe1stQP4R10jFNA_Km1dcFwmr2j7LBF3s,2184
|
|
@@ -457,9 +466,9 @@ v0/relationalai/std/re.py,sha256=7B0dPaYyEdIlEgZfDzs7HJ_MTqccYTfIZieqst6MHbk,445
|
|
|
457
466
|
v0/relationalai/std/strings.py,sha256=vHvex_W5GHhhsVws6Dfyl4w1EHdbDE3nPjT09DnpvSE,4260
|
|
458
467
|
v0/relationalai/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
459
468
|
v0/relationalai/tools/cleanup_snapshots.py,sha256=s1q1ophi1RmiTZ9QQolQ6q1K9ZwseCaOuDtI1Rm99MQ,3434
|
|
460
|
-
v0/relationalai/tools/cli.py,sha256=
|
|
469
|
+
v0/relationalai/tools/cli.py,sha256=7Ads7TGIqqUviVCW1YoVK14chhLu2v2Vr4Zo9GrInNg,76883
|
|
461
470
|
v0/relationalai/tools/cli_controls.py,sha256=PgXdmJ7JJxk_yUyhljPBV7A4qbAzvSMvjhybni7bJwo,70474
|
|
462
|
-
v0/relationalai/tools/cli_helpers.py,sha256=
|
|
471
|
+
v0/relationalai/tools/cli_helpers.py,sha256=z6RGKDNwOK8DjWtd-rxiSNdEtnwdF8Kh5d0xV9xtjkI,14449
|
|
463
472
|
v0/relationalai/tools/constants.py,sha256=A8Qz0CPs2cRUs5xaZ-Y7BCyvqmI6RLvipzwLDYZ3_PU,4505
|
|
464
473
|
v0/relationalai/tools/debugger.py,sha256=CiPy3czIR80TfnjGTTpiDSJC2ZlPneAtlddPEMri7Us,6937
|
|
465
474
|
v0/relationalai/tools/debugger_client.py,sha256=lh2ejDZkAmOBu2qOAdVqH0XnqMKM7azGmXXDpTSoq30,3741
|
|
@@ -474,16 +483,16 @@ v0/relationalai/util/constants.py,sha256=rq6c1Q5tLIewiG_M_lUtRAbmrKFUUL1jfl_nxU0
|
|
|
474
483
|
v0/relationalai/util/format.py,sha256=fLRovumUa2cu0_2gy3O5vaEbpND4p9_IIgr-vDaIGDc,3754
|
|
475
484
|
v0/relationalai/util/graph.py,sha256=eT8s0yCiJIu6D1T1fjZsLSPCcuQb2Mzl6qnljtQ5TuA,1504
|
|
476
485
|
v0/relationalai/util/list_databases.py,sha256=dHu9xQkL1MxORrHMqR5E38GybzIjsfayCnFKFKEzXL4,155
|
|
477
|
-
v0/relationalai/util/otel_configuration.py,sha256=
|
|
478
|
-
v0/relationalai/util/otel_handler.py,sha256=
|
|
486
|
+
v0/relationalai/util/otel_configuration.py,sha256=rt6jQsWBevQNMkTBT3RDHR7r-py2O05vRgx4y2XAdZc,1127
|
|
487
|
+
v0/relationalai/util/otel_handler.py,sha256=lG4fcCb4C8PvQ38c53uhW1-9--son6qztT0QmzbenWU,18131
|
|
479
488
|
v0/relationalai/util/snowflake_handler.py,sha256=mm5hm4FjjaTkDwZGocOkRK4DmLQqFWLMV05pv7mmvUg,2945
|
|
480
489
|
v0/relationalai/util/span_format_test.py,sha256=djFxvHx7IDdh0QwU4DBThTd8OQBBZTBDN4dGcpOwf1Y,1348
|
|
481
490
|
v0/relationalai/util/span_tracker.py,sha256=7vyvEBdI9uCj1dxVZCQT_W5vPMxIzxewrlRRkvD5FGA,7900
|
|
482
491
|
v0/relationalai/util/spans_file_handler.py,sha256=w34WVw19ubtrjPBkKmg0Hb-9MldICmowF1OW85KCJN0,3209
|
|
483
492
|
v0/relationalai/util/timeout.py,sha256=2o6BVNFnFc-B2j-i1pEkZcQbMRto9ps2emci0XwiA4I,783
|
|
484
493
|
v0/relationalai/util/tracing_handler.py,sha256=wJQN52PRw8R2XB1_qd-POgfGZStrj9OFL7wa5Xr6SEM,1732
|
|
485
|
-
relationalai-1.0.
|
|
486
|
-
relationalai-1.0.
|
|
487
|
-
relationalai-1.0.
|
|
488
|
-
relationalai-1.0.
|
|
489
|
-
relationalai-1.0.
|
|
494
|
+
relationalai-1.0.0a3.dist-info/METADATA,sha256=4hBJy9pOGv9uDUiDfIbGTGOX0M_N94_EptAIzzR7csc,1368
|
|
495
|
+
relationalai-1.0.0a3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
496
|
+
relationalai-1.0.0a3.dist-info/entry_points.txt,sha256=u_anMN5_VCOQNA5E2mTLT2LWc9r1i-F9yQmy3ZNAAck,91
|
|
497
|
+
relationalai-1.0.0a3.dist-info/top_level.txt,sha256=Y9cfzWf-p2omqqmVy_98m287xf0OJbj6OB5RRdkGql4,16
|
|
498
|
+
relationalai-1.0.0a3.dist-info/RECORD,,
|
v0/relationalai/__init__.py
CHANGED
|
@@ -7,8 +7,8 @@ import importlib.metadata
|
|
|
7
7
|
|
|
8
8
|
from typing import cast
|
|
9
9
|
|
|
10
|
-
from .clients import config as cfg
|
|
11
10
|
from .clients.config import Config, save_config
|
|
11
|
+
from . import clients
|
|
12
12
|
from . import dsl
|
|
13
13
|
from . import debugging
|
|
14
14
|
from . import metamodel
|
|
@@ -19,11 +19,14 @@ from . import tools
|
|
|
19
19
|
from .util.otel_configuration import configure_otel
|
|
20
20
|
from snowflake.snowpark import Session
|
|
21
21
|
from .errors import RAIException, handle_missing_integration
|
|
22
|
-
from .environments import runtime_env, SessionEnvironment
|
|
23
|
-
from v0.relationalai.tools.constants import
|
|
22
|
+
from .environments import runtime_env, SessionEnvironment, SnowbookEnvironment
|
|
23
|
+
from v0.relationalai.tools.constants import Generation
|
|
24
24
|
|
|
25
25
|
import __main__
|
|
26
26
|
|
|
27
|
+
# Define cfg after all imports since it depends on clients being imported
|
|
28
|
+
cfg = clients.config
|
|
29
|
+
|
|
27
30
|
# __version__ = importlib.metadata.version(__package__ or __name__)
|
|
28
31
|
|
|
29
32
|
__version__ = '1.0.0a'
|
|
@@ -114,9 +117,9 @@ def Model(
|
|
|
114
117
|
|
|
115
118
|
try:
|
|
116
119
|
if platform == "azure":
|
|
117
|
-
|
|
120
|
+
from v0.relationalai.clients.resources.azure.azure import Graph
|
|
118
121
|
from .util.otel_handler import disable_otel_handling, is_otel_initialized
|
|
119
|
-
model =
|
|
122
|
+
model = Graph(
|
|
120
123
|
name,
|
|
121
124
|
profile=profile,
|
|
122
125
|
config=config,
|
|
@@ -128,8 +131,18 @@ def Model(
|
|
|
128
131
|
if is_otel_initialized:
|
|
129
132
|
disable_otel_handling()
|
|
130
133
|
elif platform == "snowflake":
|
|
131
|
-
|
|
132
|
-
|
|
134
|
+
try:
|
|
135
|
+
from v0.relationalai.clients.resources.snowflake import Graph
|
|
136
|
+
except ImportError as e:
|
|
137
|
+
# Provide a helpful error message for Snowflake notebook environments
|
|
138
|
+
if isinstance(runtime_env, SnowbookEnvironment):
|
|
139
|
+
raise ImportError(
|
|
140
|
+
"Failed to import relationalai.clients.resources.snowflake. "
|
|
141
|
+
"This may indicate that the relationalai.zip package structure is incomplete. "
|
|
142
|
+
"Please ensure the zip file includes the full clients/resources/snowflake directory structure."
|
|
143
|
+
) from e
|
|
144
|
+
raise
|
|
145
|
+
model = Graph(
|
|
133
146
|
name,
|
|
134
147
|
profile=profile,
|
|
135
148
|
config=config,
|
|
@@ -164,18 +177,41 @@ def Resources(
|
|
|
164
177
|
config = config or Config(profile)
|
|
165
178
|
platform = config.get("platform", "snowflake")
|
|
166
179
|
if platform == "azure":
|
|
167
|
-
from v0.relationalai.clients.azure import Resources
|
|
180
|
+
from v0.relationalai.clients.resources.azure.azure import Resources
|
|
168
181
|
return Resources(config=config)
|
|
169
182
|
elif platform == "snowflake":
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
183
|
+
try:
|
|
184
|
+
from v0.relationalai.clients.resources.snowflake.resources_factory import create_resources_instance
|
|
185
|
+
except ImportError as e:
|
|
186
|
+
# Provide a helpful error message for Snowflake notebook environments
|
|
187
|
+
from v0.relationalai.environments import runtime_env, SnowbookEnvironment
|
|
188
|
+
if isinstance(runtime_env, SnowbookEnvironment):
|
|
189
|
+
raise ImportError(
|
|
190
|
+
"Failed to import relationalai.clients.resources.snowflake. "
|
|
191
|
+
"This may indicate that the relationalai.zip package structure is incomplete. "
|
|
192
|
+
"Please ensure the zip file includes the full clients/resources/snowflake directory structure."
|
|
193
|
+
) from e
|
|
194
|
+
raise
|
|
195
|
+
return create_resources_instance(
|
|
196
|
+
config=config,
|
|
197
|
+
profile=profile,
|
|
198
|
+
connection=connection,
|
|
199
|
+
reset_session=reset_session,
|
|
200
|
+
generation=generation or Generation.V0,
|
|
201
|
+
dry_run=False,
|
|
202
|
+
language="rel",
|
|
203
|
+
)
|
|
176
204
|
elif platform == "local":
|
|
177
|
-
from v0.relationalai.clients.
|
|
178
|
-
return
|
|
205
|
+
from v0.relationalai.clients.resources.snowflake.resources_factory import create_resources_instance
|
|
206
|
+
return create_resources_instance(
|
|
207
|
+
config=config,
|
|
208
|
+
profile=profile,
|
|
209
|
+
connection=connection,
|
|
210
|
+
reset_session=reset_session,
|
|
211
|
+
generation=generation or Generation.V0,
|
|
212
|
+
dry_run=False,
|
|
213
|
+
language="rel",
|
|
214
|
+
)
|
|
179
215
|
else:
|
|
180
216
|
raise Exception(f"Unknown platform: {platform}")
|
|
181
217
|
|
|
@@ -188,15 +224,26 @@ def Provider(
|
|
|
188
224
|
resources = Resources(profile, config, connection, generation=generation)
|
|
189
225
|
platform = resources.config.get("platform", "snowflake")
|
|
190
226
|
if platform == "azure":
|
|
191
|
-
|
|
192
|
-
resources = cast(
|
|
193
|
-
return
|
|
227
|
+
from v0.relationalai.clients.resources.azure.azure import Resources as AzureResources, Provider as AzureProvider
|
|
228
|
+
resources = cast(AzureResources, resources)
|
|
229
|
+
return AzureProvider(
|
|
194
230
|
resources=resources
|
|
195
231
|
)
|
|
196
232
|
elif platform == "snowflake":
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
233
|
+
try:
|
|
234
|
+
from v0.relationalai.clients.resources.snowflake import Resources as SnowflakeResources, Provider as SnowflakeProvider
|
|
235
|
+
except ImportError as e:
|
|
236
|
+
# Provide a helpful error message for Snowflake notebook environments
|
|
237
|
+
from v0.relationalai.environments import runtime_env, SnowbookEnvironment
|
|
238
|
+
if isinstance(runtime_env, SnowbookEnvironment):
|
|
239
|
+
raise ImportError(
|
|
240
|
+
"Failed to import relationalai.clients.resources.snowflake. "
|
|
241
|
+
"This may indicate that the relationalai.zip package structure is incomplete. "
|
|
242
|
+
"Please ensure the zip file includes the full clients/resources/snowflake directory structure."
|
|
243
|
+
) from e
|
|
244
|
+
raise
|
|
245
|
+
resources = cast(SnowflakeResources, resources)
|
|
246
|
+
return SnowflakeProvider(
|
|
200
247
|
resources=resources,
|
|
201
248
|
generation=generation
|
|
202
249
|
)
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Azure import is dropped because we need to to do runtime import of azure module to support our package running on Snowflake Notebook
|
|
2
|
-
from . import config
|
|
2
|
+
from . import config
|
|
3
|
+
|
|
4
|
+
# Lazy imports for client and local to avoid circular import issues
|
|
5
|
+
# These modules import from relationalai which imports from clients, creating a cycle
|
|
6
|
+
def __getattr__(name: str):
|
|
7
|
+
if name == 'client':
|
|
8
|
+
from . import client
|
|
9
|
+
return client
|
|
10
|
+
elif name == 'local':
|
|
11
|
+
from . import local
|
|
12
|
+
return local
|
|
13
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
3
14
|
|
|
4
15
|
# note: user must do `import relationalai.clients.azure` to get `azure` submodule
|
|
5
|
-
|
|
16
|
+
# note: snowflake module is now at relationalai.clients.resources.snowflake
|
|
17
|
+
# note: 'client' and 'local' are lazy-loaded via __getattr__, so they're not in __all__
|
|
18
|
+
__all__ = ['config']
|
|
@@ -10,12 +10,12 @@ from dataclasses import dataclass
|
|
|
10
10
|
from pandas import DataFrame
|
|
11
11
|
import time
|
|
12
12
|
|
|
13
|
-
from
|
|
14
|
-
from
|
|
13
|
+
from .hash_util import database_name_from_sproc_name
|
|
14
|
+
from ..tools.constants import USE_GRAPH_INDEX, USE_PACKAGE_MANAGER
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
from .types import AvailableModel, EngineState, Import, ImportSource, ImportsStatus, SourceMapEntry
|
|
18
|
-
from
|
|
18
|
+
from .config import Config
|
|
19
19
|
from ..compiler import Compiler
|
|
20
20
|
from ..environments import runtime_env, NotebookRuntimeEnvironment
|
|
21
21
|
from .. import dsl, debugging, metamodel as m
|
|
@@ -210,7 +210,7 @@ class ResourcesBase(ABC):
|
|
|
210
210
|
return engine
|
|
211
211
|
|
|
212
212
|
@abstractmethod
|
|
213
|
-
def auto_create_engine_async(self, name: str | None = None):
|
|
213
|
+
def auto_create_engine_async(self, name: str | None = None) -> str:
|
|
214
214
|
pass
|
|
215
215
|
|
|
216
216
|
_active_engine: EngineState|None = None
|
v0/relationalai/clients/local.py
CHANGED
|
@@ -13,10 +13,10 @@ from typing import Any, Dict, List, Iterable, Literal, Optional, Tuple, Union
|
|
|
13
13
|
from requests.adapters import HTTPAdapter
|
|
14
14
|
from urllib3.util.retry import Retry
|
|
15
15
|
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
16
|
+
from .client import ResourcesBase, ProviderBase
|
|
17
|
+
from .config import Config
|
|
18
|
+
from .types import TransactionAsyncResponse
|
|
19
|
+
from .util import get_pyrel_version
|
|
20
20
|
from ..errors import ResponseStatusException
|
|
21
21
|
from .. import debugging
|
|
22
22
|
|
|
@@ -202,7 +202,7 @@ class LocalResources(ResourcesBase):
|
|
|
202
202
|
def alter_engine_pool(self, size: str | None = None, mins: int | None = None, maxs: int | None = None):
|
|
203
203
|
raise NotImplementedError("alter_engine_pool not supported in local mode")
|
|
204
204
|
|
|
205
|
-
def auto_create_engine_async(self, name: str | None = None):
|
|
205
|
+
def auto_create_engine_async(self, name: str | None = None) -> str:
|
|
206
206
|
raise NotImplementedError("auto_create_engine_async not supported in local mode")
|
|
207
207
|
|
|
208
208
|
#--------------------------------------------------
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Resources module for RelationalAI clients.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# This package contains resource implementations for different platforms:
|
|
6
|
+
# - snowflake: Snowflake-specific resources
|
|
7
|
+
# - azure: Azure-specific resources (optional, may not be available in all environments)
|
|
8
|
+
|
|
@@ -9,18 +9,18 @@ from urllib.error import HTTPError
|
|
|
9
9
|
|
|
10
10
|
from pandas import DataFrame
|
|
11
11
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
19
|
-
from
|
|
20
|
-
from
|
|
21
|
-
from
|
|
12
|
+
from .... import debugging
|
|
13
|
+
from ...util import poll_with_specified_overhead
|
|
14
|
+
|
|
15
|
+
from ....errors import EngineNotFoundException, RAIException, AzureUnsupportedQueryTimeoutException
|
|
16
|
+
from ....rel_utils import assert_no_problems
|
|
17
|
+
from ....loaders.loader import emit_delete_import, import_file, list_available_resources
|
|
18
|
+
from ...config import Config
|
|
19
|
+
from ...types import EngineState, ImportSource, ImportSourceFile, TransactionAsyncResponse
|
|
20
|
+
from ...client import Client, ExportParams, ProviderBase, ResourcesBase
|
|
21
|
+
from .... import dsl, rel, metamodel as m
|
|
22
22
|
from railib import api
|
|
23
|
-
from
|
|
23
|
+
from ... import result_helpers
|
|
24
24
|
|
|
25
25
|
#--------------------------------------------------
|
|
26
26
|
# Constants
|
|
@@ -105,7 +105,7 @@ class Resources(ResourcesBase):
|
|
|
105
105
|
def resume_engine_async(self, name:str):
|
|
106
106
|
return api.resume_engine(self._api_ctx(), name)
|
|
107
107
|
|
|
108
|
-
def auto_create_engine_async(self, name: str | None = None):
|
|
108
|
+
def auto_create_engine_async(self, name: str | None = None) -> str:
|
|
109
109
|
raise Exception("Azure doesn't support auto_create_engine_async")
|
|
110
110
|
|
|
111
111
|
def alter_engine_pool(self, size: str | None = None, mins: int | None = None, maxs: int | None = None):
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Snowflake resources module.
|
|
3
|
+
"""
|
|
4
|
+
# Import order matters - Resources must be imported first since other classes depend on it
|
|
5
|
+
from .snowflake import Resources, Provider, Graph, SnowflakeClient, APP_NAME, PYREL_ROOT_DB, ExecContext, INTERNAL_ENGINE_SIZES, ENGINE_SIZES_AWS, ENGINE_SIZES_AZURE, PrimaryKey
|
|
6
|
+
|
|
7
|
+
# These imports depend on Resources, so they come after
|
|
8
|
+
from .cli_resources import CLIResources
|
|
9
|
+
from .use_index_resources import UseIndexResources
|
|
10
|
+
from .direct_access_resources import DirectAccessResources
|
|
11
|
+
from .resources_factory import create_resources_instance
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
'Resources', 'DirectAccessResources', 'Provider', 'Graph', 'SnowflakeClient',
|
|
15
|
+
'APP_NAME', 'PYREL_ROOT_DB', 'CLIResources', 'UseIndexResources', 'ExecContext',
|
|
16
|
+
'INTERNAL_ENGINE_SIZES', 'ENGINE_SIZES_AWS', 'ENGINE_SIZES_AZURE', 'PrimaryKey',
|
|
17
|
+
'create_resources_instance',
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""
|
|
2
|
+
CLI Resources - Resources class for CLI operations.
|
|
3
|
+
Re-raises exceptions without transformation and provides CLI utility methods.
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
import json
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from ....tools.constants import RAI_APP_NAME
|
|
10
|
+
|
|
11
|
+
# Import Resources from snowflake - this creates a dependency but no circular import
|
|
12
|
+
# since snowflake.py doesn't import from this file
|
|
13
|
+
from .snowflake import Resources, ExecContext
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CLIResources(Resources):
|
|
17
|
+
"""
|
|
18
|
+
Resources class for CLI operations.
|
|
19
|
+
Re-raises exceptions without transformation and provides CLI utility methods.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
def _handle_standard_exec_errors(self, e: Exception, ctx: ExecContext) -> Any | None:
|
|
23
|
+
"""For CLI resources, re-raise exceptions without transformation."""
|
|
24
|
+
raise e
|
|
25
|
+
|
|
26
|
+
def list_warehouses(self):
|
|
27
|
+
"""List all warehouses in the Snowflake account."""
|
|
28
|
+
results = self._exec("SHOW WAREHOUSES")
|
|
29
|
+
if not results:
|
|
30
|
+
return []
|
|
31
|
+
return [{"name": name}
|
|
32
|
+
for (name, *rest) in results]
|
|
33
|
+
|
|
34
|
+
def list_compute_pools(self):
|
|
35
|
+
"""List all compute pools in the Snowflake account."""
|
|
36
|
+
results = self._exec("SHOW COMPUTE POOLS")
|
|
37
|
+
if not results:
|
|
38
|
+
return []
|
|
39
|
+
return [{"name": name, "status": status, "min_nodes": min_nodes, "max_nodes": max_nodes, "instance_family": instance_family}
|
|
40
|
+
for (name, status, min_nodes, max_nodes, instance_family, *rest) in results]
|
|
41
|
+
|
|
42
|
+
def list_roles(self):
|
|
43
|
+
"""List all available roles in the Snowflake account."""
|
|
44
|
+
results = self._exec("SELECT CURRENT_AVAILABLE_ROLES()")
|
|
45
|
+
if not results:
|
|
46
|
+
return []
|
|
47
|
+
# the response is a single row with a single column containing
|
|
48
|
+
# a stringified JSON array of role names:
|
|
49
|
+
row = results[0]
|
|
50
|
+
if not row:
|
|
51
|
+
return []
|
|
52
|
+
return [{"name": name} for name in json.loads(row[0])]
|
|
53
|
+
|
|
54
|
+
def list_apps(self):
|
|
55
|
+
"""List all applications in the Snowflake account."""
|
|
56
|
+
all_apps = self._exec(f"SHOW APPLICATIONS LIKE '{RAI_APP_NAME}'")
|
|
57
|
+
if not all_apps:
|
|
58
|
+
all_apps = self._exec("SHOW APPLICATIONS")
|
|
59
|
+
if not all_apps:
|
|
60
|
+
return []
|
|
61
|
+
return [{"name": name}
|
|
62
|
+
for (time, name, *rest) in all_apps]
|
|
63
|
+
|
|
64
|
+
def list_databases(self):
|
|
65
|
+
"""List all databases in the Snowflake account."""
|
|
66
|
+
results = self._exec("SHOW DATABASES")
|
|
67
|
+
if not results:
|
|
68
|
+
return []
|
|
69
|
+
return [{"name": name}
|
|
70
|
+
for (time, name, *rest) in results]
|
|
71
|
+
|
|
72
|
+
def list_sf_schemas(self, database: str):
|
|
73
|
+
"""List all schemas in a given database."""
|
|
74
|
+
results = self._exec(f"SHOW SCHEMAS IN {database}")
|
|
75
|
+
if not results:
|
|
76
|
+
return []
|
|
77
|
+
return [{"name": name}
|
|
78
|
+
for (time, name, *rest) in results]
|
|
79
|
+
|
|
80
|
+
def list_tables(self, database: str, schema: str):
|
|
81
|
+
"""List all tables and views in a given schema."""
|
|
82
|
+
results = self._exec(f"SHOW OBJECTS IN {database}.{schema}")
|
|
83
|
+
items = []
|
|
84
|
+
if results:
|
|
85
|
+
for (time, name, db_name, schema_name, kind, *rest) in results:
|
|
86
|
+
items.append({"name": name, "kind": kind.lower()})
|
|
87
|
+
return items
|