snowflake-cli 3.11.0__py3-none-any.whl → 3.12.0__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.
- snowflake/cli/__about__.py +1 -1
- snowflake/cli/_app/cli_app.py +0 -1
- snowflake/cli/_app/printing.py +153 -19
- snowflake/cli/_plugins/dbt/commands.py +37 -8
- snowflake/cli/_plugins/dbt/manager.py +144 -10
- snowflake/cli/_plugins/dcm/commands.py +65 -90
- snowflake/cli/_plugins/dcm/manager.py +137 -50
- snowflake/cli/_plugins/logs/commands.py +7 -0
- snowflake/cli/_plugins/logs/manager.py +21 -1
- snowflake/cli/_plugins/nativeapp/sf_sql_facade.py +3 -1
- snowflake/cli/_plugins/snowpark/common.py +1 -0
- snowflake/cli/_plugins/snowpark/package/anaconda_packages.py +29 -5
- snowflake/cli/_plugins/snowpark/package_utils.py +44 -3
- snowflake/cli/_plugins/spcs/services/manager.py +5 -4
- snowflake/cli/_plugins/sql/lexer/types.py +1 -0
- snowflake/cli/_plugins/sql/repl.py +100 -26
- snowflake/cli/_plugins/sql/repl_commands.py +607 -0
- snowflake/cli/_plugins/sql/statement_reader.py +44 -20
- snowflake/cli/api/artifacts/bundle_map.py +32 -2
- snowflake/cli/api/artifacts/regex_resolver.py +54 -0
- snowflake/cli/api/artifacts/upload.py +5 -1
- snowflake/cli/api/artifacts/utils.py +12 -1
- snowflake/cli/api/cli_global_context.py +7 -0
- snowflake/cli/api/console/abc.py +13 -2
- snowflake/cli/api/console/console.py +20 -0
- snowflake/cli/api/constants.py +9 -0
- snowflake/cli/api/entities/utils.py +10 -6
- snowflake/cli/api/feature_flags.py +1 -0
- snowflake/cli/api/identifiers.py +18 -1
- snowflake/cli/api/project/schemas/entities/entities.py +0 -6
- snowflake/cli/api/rendering/sql_templates.py +2 -0
- {snowflake_cli-3.11.0.dist-info → snowflake_cli-3.12.0.dist-info}/METADATA +5 -5
- {snowflake_cli-3.11.0.dist-info → snowflake_cli-3.12.0.dist-info}/RECORD +36 -36
- snowflake/cli/_plugins/dcm/dcm_project_entity_model.py +0 -59
- snowflake/cli/_plugins/sql/snowsql_commands.py +0 -331
- {snowflake_cli-3.11.0.dist-info → snowflake_cli-3.12.0.dist-info}/WHEEL +0 -0
- {snowflake_cli-3.11.0.dist-info → snowflake_cli-3.12.0.dist-info}/entry_points.txt +0 -0
- {snowflake_cli-3.11.0.dist-info → snowflake_cli-3.12.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
snowflake/cli/__about__.py,sha256=
|
|
1
|
+
snowflake/cli/__about__.py,sha256=qz9F4DAjPM7pkMjXlHqaZZfw-wdDibgYH0Nloxuyq30,853
|
|
2
2
|
snowflake/cli/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
3
3
|
snowflake/cli/_app/__init__.py,sha256=CR_uTgoqHnU1XdyRhm5iQsS86yWXGVx5Ht7aGSDNFmc,765
|
|
4
4
|
snowflake/cli/_app/__main__.py,sha256=ZmcFdFqAtk2mFMz-cqCFdGd0iYzc7UsLH1oT1U40S0k,858
|
|
5
|
-
snowflake/cli/_app/cli_app.py,sha256=
|
|
5
|
+
snowflake/cli/_app/cli_app.py,sha256=KhyQQ9OXHEKUEJ2yQBAoZHJQKbCHdmLz7heRDBf1XyY,10203
|
|
6
6
|
snowflake/cli/_app/constants.py,sha256=jsdljrWgkN7djzYLA4U5YIP-bQI7dxiJ01sVgjjpVMk,1293
|
|
7
7
|
snowflake/cli/_app/loggers.py,sha256=etu9xvhNRQwAn5L1r-x5uaCZ_TSL7Y3RMRjLQxx9nyY,6648
|
|
8
8
|
snowflake/cli/_app/main_typer.py,sha256=v2n7moen3CkP-SfsGrTh-MzFgqG6Ak8bJa8E2dGKzFw,2111
|
|
9
|
-
snowflake/cli/_app/printing.py,sha256=
|
|
9
|
+
snowflake/cli/_app/printing.py,sha256=hMtq81huaX44y2H9hgCoDzIbW10RnpJYtT4nf2ZCrj4,11851
|
|
10
10
|
snowflake/cli/_app/snow_connector.py,sha256=UEXWCWSyKgUx1WGy6r0QS6gB1WaKUklie3bl06qHECw,13447
|
|
11
11
|
snowflake/cli/_app/telemetry.py,sha256=Rcl9sSTYEujrLMUvd2SsvmJMbVGE_ErOnnOLdBnpI60,9846
|
|
12
12
|
snowflake/cli/_app/version_check.py,sha256=tM3j8FmqcONz3nfiv9WZIU01wy4ZWbKgiWH_8GYzCfM,5585
|
|
@@ -53,14 +53,13 @@ snowflake/cli/_plugins/cortex/manager.py,sha256=6ZppMLGxh3u8NZMpAoHpnwus47lcUEzu
|
|
|
53
53
|
snowflake/cli/_plugins/cortex/plugin_spec.py,sha256=wbOkXoUTVdXCj8m_-bJRi7IiKxS03q0XEgxrT7aB3yU,995
|
|
54
54
|
snowflake/cli/_plugins/cortex/types.py,sha256=9KQPlQRkoR67ty8VoqsifJfaoeLJPXZzCJ6dehYWYLE,827
|
|
55
55
|
snowflake/cli/_plugins/dbt/__init__.py,sha256=JhO1yb1LCYqYx-Ya-MlhubtiqD82CuvWF09dDMafxRM,578
|
|
56
|
-
snowflake/cli/_plugins/dbt/commands.py,sha256=
|
|
56
|
+
snowflake/cli/_plugins/dbt/commands.py,sha256=EF0pOQwzkxRp0OdRYB1MW4GoGxRj6-RMeMwK0SQR7LI,8124
|
|
57
57
|
snowflake/cli/_plugins/dbt/constants.py,sha256=mAwkVchQikcfegHqs-PmziZJRd9-DEAienWxpoHhnPc,962
|
|
58
|
-
snowflake/cli/_plugins/dbt/manager.py,sha256=
|
|
58
|
+
snowflake/cli/_plugins/dbt/manager.py,sha256=aRTVM8ciWDUNOGPgEnj280pJXatpucH2KlxJbUERxQc,12608
|
|
59
59
|
snowflake/cli/_plugins/dbt/plugin_spec.py,sha256=7yEc3tLgvw3iUhALpmaVpS-iePdSMjFdFSZVybf5KTc,992
|
|
60
60
|
snowflake/cli/_plugins/dcm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
|
-
snowflake/cli/_plugins/dcm/commands.py,sha256=
|
|
62
|
-
snowflake/cli/_plugins/dcm/
|
|
63
|
-
snowflake/cli/_plugins/dcm/manager.py,sha256=dSdaihmtTRzA_9lLJ1apMiFW-ONLOxkY725bDERbFOQ,3487
|
|
61
|
+
snowflake/cli/_plugins/dcm/commands.py,sha256=6MMSgu54J2XwTDBCJ9b3ZbewntOasEzzCGj_IIs5JYs,7888
|
|
62
|
+
snowflake/cli/_plugins/dcm/manager.py,sha256=Isrj2GpP3gKWR-zNB6laKBWD7ZnE3W-bsZIkkbM54uM,7329
|
|
64
63
|
snowflake/cli/_plugins/dcm/plugin_spec.py,sha256=U-p1UrjS2QTkk6j5-XfMsehc6gzcFHXVDjI4qnm5aPs,992
|
|
65
64
|
snowflake/cli/_plugins/git/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
66
65
|
snowflake/cli/_plugins/git/commands.py,sha256=87R8Fs_f6BUdfLv85QGlfTTH6K-Y_oDlqJyZ3jUpBVg,11320
|
|
@@ -74,8 +73,8 @@ snowflake/cli/_plugins/init/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh
|
|
|
74
73
|
snowflake/cli/_plugins/init/commands.py,sha256=_L_3ugnMsTJ9-JPr-dtdGsmLExc0cW7IuGWr4oc9ZFs,9019
|
|
75
74
|
snowflake/cli/_plugins/init/plugin_spec.py,sha256=NYckJroTPV_M30QVgk1VutFPqInCkOGsL2gYQUDYuEA,994
|
|
76
75
|
snowflake/cli/_plugins/logs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
77
|
-
snowflake/cli/_plugins/logs/commands.py,sha256=
|
|
78
|
-
snowflake/cli/_plugins/logs/manager.py,sha256=
|
|
76
|
+
snowflake/cli/_plugins/logs/commands.py,sha256=ilMHSOJqqxBrIcZNZU8oxSq0wMNtM7iH7q8cwmu_8ro,3652
|
|
77
|
+
snowflake/cli/_plugins/logs/manager.py,sha256=CvpizLGWNqa2BzWXn5V2dGcJzQ3z5k4RIaclRRWiBZE,4418
|
|
79
78
|
snowflake/cli/_plugins/logs/plugin_spec.py,sha256=bsed6aIa1B3ktwh9pBqTqmGxif3iTP6L32-3XCRcQXw,415
|
|
80
79
|
snowflake/cli/_plugins/logs/utils.py,sha256=LF3e3551bi25rWIVlmRb_x9hC8VxLOcNpcRc-p9E-pg,1811
|
|
81
80
|
snowflake/cli/_plugins/nativeapp/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
@@ -91,7 +90,7 @@ snowflake/cli/_plugins/nativeapp/same_account_install_method.py,sha256=97Q7tWWcN
|
|
|
91
90
|
snowflake/cli/_plugins/nativeapp/sf_facade.py,sha256=Ng5-fZuPyCtOCsUdeeAgIt4k7S0oNXqB-sUTbII9mJ4,1047
|
|
92
91
|
snowflake/cli/_plugins/nativeapp/sf_facade_constants.py,sha256=nVWM_gbvW53hEPYwmySw43BbPixivv_qegMAcHQ7wxU,774
|
|
93
92
|
snowflake/cli/_plugins/nativeapp/sf_facade_exceptions.py,sha256=YzUIgAvcGUxJ8hOvLnLdM-PR2gD0pWmIvNi0tTRAofo,7245
|
|
94
|
-
snowflake/cli/_plugins/nativeapp/sf_sql_facade.py,sha256=
|
|
93
|
+
snowflake/cli/_plugins/nativeapp/sf_sql_facade.py,sha256=UxnoJSjbXUGf3AEE7AK489R21joxsCOByzp7GA2y9wI,75643
|
|
95
94
|
snowflake/cli/_plugins/nativeapp/utils.py,sha256=2sSZKKjaSbRebQ28oMWNsopeAMQh5ce3aDO93dSIPLs,3380
|
|
96
95
|
snowflake/cli/_plugins/nativeapp/codegen/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
97
96
|
snowflake/cli/_plugins/nativeapp/codegen/artifact_processor.py,sha256=sQ3dmbm0PkDT_V5kIDT5Z4BlFHFNFRS7wTXopdTk3PA,2935
|
|
@@ -137,9 +136,9 @@ snowflake/cli/_plugins/plugin/manager.py,sha256=eeW5b0zAvvsZREgIVH7afAQbKHI2Yqqd
|
|
|
137
136
|
snowflake/cli/_plugins/plugin/plugin_spec.py,sha256=5XZJPT42ZIEARYvthic3jLEB4CvDUdMeWTM6YfDkD9k,995
|
|
138
137
|
snowflake/cli/_plugins/snowpark/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
139
138
|
snowflake/cli/_plugins/snowpark/commands.py,sha256=rzuebpbPRxZcQ8iRgeA8xvYGj_s3nUggivfp2ZL1V5g,17823
|
|
140
|
-
snowflake/cli/_plugins/snowpark/common.py,sha256=
|
|
139
|
+
snowflake/cli/_plugins/snowpark/common.py,sha256=738xxAAVtEP6BRLESjsdtrFhKHmT4KxhKQ1UvOL9B9M,13761
|
|
141
140
|
snowflake/cli/_plugins/snowpark/models.py,sha256=Bd69O3krCS5HvQdHhjQsbhFi0wtYOD_Y9sj6lBMR7KU,4766
|
|
142
|
-
snowflake/cli/_plugins/snowpark/package_utils.py,sha256=
|
|
141
|
+
snowflake/cli/_plugins/snowpark/package_utils.py,sha256=L8382l5IS-JdhdKH1O2FoYDJvhwCtACgZ32KmH9HMjs,13386
|
|
143
142
|
snowflake/cli/_plugins/snowpark/plugin_spec.py,sha256=2fzlWnGL57oCLWfmkfo6USxvJpy7K9KPE3-ZqwILQcg,997
|
|
144
143
|
snowflake/cli/_plugins/snowpark/snowpark_entity.py,sha256=u3m90KB47lb0mn7KjX5fvrXnJgtHckY9PDUIqf1brOU,11091
|
|
145
144
|
snowflake/cli/_plugins/snowpark/snowpark_entity_model.py,sha256=4He2u4cGhFJ6uiShFAmAJkIXQUIGb6HZcRf4kJHq3Gc,7273
|
|
@@ -147,7 +146,7 @@ snowflake/cli/_plugins/snowpark/snowpark_project_paths.py,sha256=hHzKro0qOk_1hOy
|
|
|
147
146
|
snowflake/cli/_plugins/snowpark/snowpark_shared.py,sha256=bvKQa0FkB0UCoqIkxAJAYyymaXUuaiQ5hAe5m1GTXXk,1723
|
|
148
147
|
snowflake/cli/_plugins/snowpark/zipper.py,sha256=ZKB-SGM-onVEcwkpXV2hcCuuioL8PJGHEJccPwYLILM,3585
|
|
149
148
|
snowflake/cli/_plugins/snowpark/package/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
150
|
-
snowflake/cli/_plugins/snowpark/package/anaconda_packages.py,sha256=
|
|
149
|
+
snowflake/cli/_plugins/snowpark/package/anaconda_packages.py,sha256=C-iiuAUc_Uouv3ABm5jKK4Ns8_pXvnBTyB10bHLRlOo,8988
|
|
151
150
|
snowflake/cli/_plugins/snowpark/package/commands.py,sha256=USqZE-5PAVpVO5NkwCXALF5oXLadaoc9b6O4guLdjCs,6990
|
|
152
151
|
snowflake/cli/_plugins/snowpark/package/manager.py,sha256=sd-SQplvq7Y4mh3AKBGRCnndKn4ZEm6VVyZJllGJ9ro,1631
|
|
153
152
|
snowflake/cli/_plugins/snowpark/package/utils.py,sha256=NEvKsK_kxKt_38GVOoiq8Mq4Aq6A67rrdf1tGdP6mK8,1012
|
|
@@ -169,7 +168,7 @@ snowflake/cli/_plugins/spcs/image_repository/image_repository_entity_model.py,sh
|
|
|
169
168
|
snowflake/cli/_plugins/spcs/image_repository/manager.py,sha256=FRvp92iq2bhFvhcuErEC1o9snTJzW59ykzUZGY8syZw,3336
|
|
170
169
|
snowflake/cli/_plugins/spcs/services/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
171
170
|
snowflake/cli/_plugins/spcs/services/commands.py,sha256=y52_YFAC3OZatR41pSF8xvqnloOm8VdwpCapMp-wq20,19376
|
|
172
|
-
snowflake/cli/_plugins/spcs/services/manager.py,sha256=
|
|
171
|
+
snowflake/cli/_plugins/spcs/services/manager.py,sha256=B6fLc3e9Ssh4x3qLO52mLrd4F5dAfo5YuHfS6Z6s-Qs,21839
|
|
173
172
|
snowflake/cli/_plugins/spcs/services/service_entity.py,sha256=wEPGgW99uWaSvyvR42e2yLaoH0VuGK3JQio1Nv0a4xs,210
|
|
174
173
|
snowflake/cli/_plugins/spcs/services/service_entity_model.py,sha256=VQ1b6ij2x4eA-RSZoJfUg2NnqsXD53curw1rU_BqzSE,1856
|
|
175
174
|
snowflake/cli/_plugins/spcs/services/service_project_paths.py,sha256=9frP-BzPTs3I2C2Rt9MsuYBMvUdXomOzI7AW4ciXK9U,389
|
|
@@ -177,16 +176,16 @@ snowflake/cli/_plugins/sql/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9
|
|
|
177
176
|
snowflake/cli/_plugins/sql/commands.py,sha256=O7uiNX84tjLM4DgkTS1LRii6AEYA8fKAvPxBqMigrUA,6751
|
|
178
177
|
snowflake/cli/_plugins/sql/manager.py,sha256=se0tD88dq3ulkXK_Jbwb18a8solNSSEDQviW4k6YTS0,5109
|
|
179
178
|
snowflake/cli/_plugins/sql/plugin_spec.py,sha256=7wcy3fW00uBZL4qGnAC_UKBIksJg6GJcZfZsY8Izz-A,993
|
|
180
|
-
snowflake/cli/_plugins/sql/repl.py,sha256=
|
|
181
|
-
snowflake/cli/_plugins/sql/
|
|
179
|
+
snowflake/cli/_plugins/sql/repl.py,sha256=I2OslIpmxOJ6nRbDSkrprdyimY6lTu6SP9EUTA46uFI,10855
|
|
180
|
+
snowflake/cli/_plugins/sql/repl_commands.py,sha256=7zFdQHWPFxsa4uhUK3zK3OWWhPPzzmDnCLkFtyXgNfc,21506
|
|
182
181
|
snowflake/cli/_plugins/sql/snowsql_templating.py,sha256=VTPvFzZihZnu6R5L1JMaVdzxfviSRoMLlNyxK87sE5E,881
|
|
183
|
-
snowflake/cli/_plugins/sql/statement_reader.py,sha256=
|
|
182
|
+
snowflake/cli/_plugins/sql/statement_reader.py,sha256=45badglPROfuh65A8JXIQBgCHO1tQmXEdvmfaMggT5U,10502
|
|
184
183
|
snowflake/cli/_plugins/sql/lexer/__init__.py,sha256=oHKFGoUTgl1JLhIKheDXHOyAsK4m7GzHm_KrmXfH3UA,181
|
|
185
184
|
snowflake/cli/_plugins/sql/lexer/completer.py,sha256=UxpNAxzZPX3hrp1AT_WVmPArORHF35OBida8W6DOYro,541
|
|
186
185
|
snowflake/cli/_plugins/sql/lexer/functions.py,sha256=SrXrxd6Mt3lnDuj6IYCZtbPMN_yVR6Ygan_R69fPvfo,7625
|
|
187
186
|
snowflake/cli/_plugins/sql/lexer/keywords.py,sha256=H2ElLX76COhB1wPiDmgufz-1ZAa2t5Jc_ji08zy3D8Q,7738
|
|
188
187
|
snowflake/cli/_plugins/sql/lexer/lexer.py,sha256=6cVtAm-bCtyxzgp3DghXGdDQqHqHiPQlVGmdTbNYlgI,1896
|
|
189
|
-
snowflake/cli/_plugins/sql/lexer/types.py,sha256=
|
|
188
|
+
snowflake/cli/_plugins/sql/lexer/types.py,sha256=UbEa9TNu0pu1M9YGVhw8T3UwlhffPnFfjTqJnESceyc,555
|
|
190
189
|
snowflake/cli/_plugins/stage/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
191
190
|
snowflake/cli/_plugins/stage/commands.py,sha256=XDxeC3pClc1tzc_Uusai6aHKoL-am-PxWbWOQU74bo4,9594
|
|
192
191
|
snowflake/cli/_plugins/stage/diff.py,sha256=eaj9c-T4mXeOQGfGgBMxPhachYULKyaik2HCa9nRJ0U,10536
|
|
@@ -206,14 +205,14 @@ snowflake/cli/_plugins/workspace/commands.py,sha256=DZLJF69jvD3J8lb0ZljRmSzhTCaY
|
|
|
206
205
|
snowflake/cli/_plugins/workspace/context.py,sha256=EHiEJP663W0z0LhmvxI-odN9-KIkEiUeLgOxQV7sHgw,1006
|
|
207
206
|
snowflake/cli/_plugins/workspace/manager.py,sha256=3Go5qgoWEytLCxQgU637Lk3-pzWbmbJoS9nWsDOt-eU,3359
|
|
208
207
|
snowflake/cli/_plugins/workspace/plugin_spec.py,sha256=DvjilAunPuBuSIgKHOPcAVfk8-ZaCyJbfo8k1oau3cA,997
|
|
209
|
-
snowflake/cli/api/cli_global_context.py,sha256=
|
|
208
|
+
snowflake/cli/api/cli_global_context.py,sha256=S16W_4jxpa6ztWO1Op0iF5-F6Ck7XJJlyz7oO-R7ZZc,9767
|
|
210
209
|
snowflake/cli/api/config.py,sha256=CTYbJN7Yb1NvqDB07eFtfoxABAQb0k0N5nG7DYOGpMI,15117
|
|
211
210
|
snowflake/cli/api/connections.py,sha256=zItH6oAuLD6H2GL0I2AyGlFZkMKPmqe9RPyhlHOxOVQ,9470
|
|
212
|
-
snowflake/cli/api/constants.py,sha256=
|
|
211
|
+
snowflake/cli/api/constants.py,sha256=v42SRgCIpYjxm5SiEwoQefOqBVMOhw1_9f8UHrJ-v9A,4032
|
|
213
212
|
snowflake/cli/api/errno.py,sha256=nVQ2kO9nPaA1uGB4yZiKTwtE2LiQmINHTutziA37c6s,3871
|
|
214
213
|
snowflake/cli/api/exceptions.py,sha256=3Esa8gL0D_dsbpjWpBFWt1fQW8u4BgU59kx1B5Vgw9A,9228
|
|
215
|
-
snowflake/cli/api/feature_flags.py,sha256=
|
|
216
|
-
snowflake/cli/api/identifiers.py,sha256=
|
|
214
|
+
snowflake/cli/api/feature_flags.py,sha256=ILkmuRkE6rIR01G6-Ib8xSsEU7RY2EooNvfptarHf-4,2617
|
|
215
|
+
snowflake/cli/api/identifiers.py,sha256=5h7_lTYJQvQy4_QnyPigduJyHye2_9U-1echPIgTmhk,7445
|
|
217
216
|
snowflake/cli/api/metrics.py,sha256=l-khpKWvRF8OB86OhJ2H61jrcTdMDGZe_QM1_-yqWT8,10694
|
|
218
217
|
snowflake/cli/api/rest_api.py,sha256=RUo4prPAGmi2iQt1o96co3pWfo2t5PLCVBB2m1jlrNA,7404
|
|
219
218
|
snowflake/cli/api/sanitizers.py,sha256=7EKqVQ3KOob0IFFoc_GmXPYpRhgnmIqhnJSvHPgxM5I,1211
|
|
@@ -223,10 +222,11 @@ snowflake/cli/api/secure_utils.py,sha256=w3f1JU2ntOXGQ2STeqU0QiAVx_sLLEfgPwIvppr
|
|
|
223
222
|
snowflake/cli/api/sql_execution.py,sha256=gfF8ebBCAruqvRX0ftXKr4QOHB6P7djnWOWa-ChcCjo,12155
|
|
224
223
|
snowflake/cli/api/stage_path.py,sha256=N-2tNdUGNl8NxORDrBfVJyRo9CupMWtGD0XqLUX6GhE,8728
|
|
225
224
|
snowflake/cli/api/artifacts/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
226
|
-
snowflake/cli/api/artifacts/bundle_map.py,sha256=
|
|
225
|
+
snowflake/cli/api/artifacts/bundle_map.py,sha256=Kbl27rWYuWHo3r_4w0LrGDxWH-8K2iPgesJBx4wyq-M,23062
|
|
227
226
|
snowflake/cli/api/artifacts/common.py,sha256=YTL_CSdAWEB0HMQZ5063nRrdQuFQbLAc5U5ZjNAU7jY,2058
|
|
228
|
-
snowflake/cli/api/artifacts/
|
|
229
|
-
snowflake/cli/api/artifacts/
|
|
227
|
+
snowflake/cli/api/artifacts/regex_resolver.py,sha256=l9HqrsLYZrld35H4CaI9KFr-u5QfNE2FLWdDkNafDrg,1838
|
|
228
|
+
snowflake/cli/api/artifacts/upload.py,sha256=zsrUPi81zrz8RNpskpxZf3-TUVPczx59-4likZZPO8o,1847
|
|
229
|
+
snowflake/cli/api/artifacts/utils.py,sha256=nHQ22Qj4l23-CPiv5Wv-mbXQKM3E5FMZT74XXZ4u60w,3962
|
|
230
230
|
snowflake/cli/api/commands/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
231
231
|
snowflake/cli/api/commands/alias.py,sha256=TF6QgkorFTn9UV5F3tvxIJZ56iK1vIjqZFMxVtrTIzk,795
|
|
232
232
|
snowflake/cli/api/commands/common.py,sha256=6CrJqhQl-Mu0jwFmWyNKvvB7jFQ1EJdnKFW9BNHVask,462
|
|
@@ -238,12 +238,12 @@ snowflake/cli/api/commands/overrideable_parameter.py,sha256=LDiRQudkTeoWu5y_qTCV
|
|
|
238
238
|
snowflake/cli/api/commands/snow_typer.py,sha256=Mgz6QbinT53vYoTO6_1LtpLY-MhnYoY5m8pjBaucPZo,10775
|
|
239
239
|
snowflake/cli/api/commands/utils.py,sha256=vZcVtPZsuH312FPf9yw-JooNWE7Tli-zVWh4u-gQk7c,1605
|
|
240
240
|
snowflake/cli/api/console/__init__.py,sha256=jKSsXJDqyQZwJ--5eRzUqb2nNvq-lo_NC1pbqK5xROI,665
|
|
241
|
-
snowflake/cli/api/console/abc.py,sha256=
|
|
242
|
-
snowflake/cli/api/console/console.py,sha256=
|
|
241
|
+
snowflake/cli/api/console/abc.py,sha256=GzoaGSfVT-Usws06DznwQJLMSidUMePgVEmAY6Izv6Y,3583
|
|
242
|
+
snowflake/cli/api/console/console.py,sha256=Q6_R0dRAQF0NpCbx7QpD2HjlqdbRvDMH6pzJDcD3kY4,5204
|
|
243
243
|
snowflake/cli/api/console/enum.py,sha256=0dhepH8DEmxLjij9XxFX3kEZ_WE267zsffzecEwA2fU,675
|
|
244
244
|
snowflake/cli/api/entities/common.py,sha256=_IaDpqneQdE6MRZ6B7-dLXP2XiFBvoaNjjki59GP-_c,6071
|
|
245
245
|
snowflake/cli/api/entities/resolver.py,sha256=yD1m71X7-JPQ6dy5mKyzVR_9d3Eji4z-nRfKd_lqXFo,5922
|
|
246
|
-
snowflake/cli/api/entities/utils.py,sha256=
|
|
246
|
+
snowflake/cli/api/entities/utils.py,sha256=F_GFI1vLnAk66W3ho28vNhHi-U4HamqMAiMWpF37q4I,15068
|
|
247
247
|
snowflake/cli/api/output/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
248
248
|
snowflake/cli/api/output/formats.py,sha256=WndZsPPCcWFY76L7L1ovBrXi_gk6ubcu5vpVMamrfes,821
|
|
249
249
|
snowflake/cli/api/output/types.py,sha256=et9AmDwU98x_w0fy-84p2BsOU4N_cFWhbjyWQDHncZg,5225
|
|
@@ -266,7 +266,7 @@ snowflake/cli/api/project/schemas/template.py,sha256=VJSwVfkWoNJ_OB850n4vLu7WD7y
|
|
|
266
266
|
snowflake/cli/api/project/schemas/updatable_model.py,sha256=y_JQSy4E67vdzKbuHmm4fmcSTHjTUgI3ulcHV1_O57M,7621
|
|
267
267
|
snowflake/cli/api/project/schemas/entities/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
268
268
|
snowflake/cli/api/project/schemas/entities/common.py,sha256=clFYkFVUoeG0K4wRe4qSvNb95BQXefax16wtmO3zyjA,10385
|
|
269
|
-
snowflake/cli/api/project/schemas/entities/entities.py,sha256=
|
|
269
|
+
snowflake/cli/api/project/schemas/entities/entities.py,sha256=PE6kXGelhcrYp79to1NGLXxZ63DQ69Sk1r73a4IXmFM,2904
|
|
270
270
|
snowflake/cli/api/project/schemas/v1/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
271
271
|
snowflake/cli/api/project/schemas/v1/identifier_model.py,sha256=Te0CraVdflIrvNXYljReofBCNfkGDdZ0G_aUY19GFqE,1868
|
|
272
272
|
snowflake/cli/api/project/schemas/v1/native_app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -283,7 +283,7 @@ snowflake/cli/api/rendering/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh
|
|
|
283
283
|
snowflake/cli/api/rendering/jinja.py,sha256=gpHUJmgiFx8iDJFy0DgsdtBHY2k95pY9kbW51Z2VYKM,3726
|
|
284
284
|
snowflake/cli/api/rendering/project_definition_templates.py,sha256=RzVmw7JwLoeBntgLNIG4QESqKGr1i2K3XivFszqWby8,1457
|
|
285
285
|
snowflake/cli/api/rendering/project_templates.py,sha256=5QDKGbJXSdvqFRF10L09aoInzyCsK8XoUk1gRapndOk,3489
|
|
286
|
-
snowflake/cli/api/rendering/sql_templates.py,sha256=
|
|
286
|
+
snowflake/cli/api/rendering/sql_templates.py,sha256=6VA6lbmkvIXFy2YbTmY0NvOzp28OUr2KignAMPScbpQ,6076
|
|
287
287
|
snowflake/cli/api/utils/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
|
|
288
288
|
snowflake/cli/api/utils/cursor.py,sha256=JlyUG5b4EXii71Dm7qiTdptjwIsOOmEv2QmZA1cY8NQ,1222
|
|
289
289
|
snowflake/cli/api/utils/definition_rendering.py,sha256=AgHWnpi3yit0sd6MsDTvuCQFGCNZ-giuuwsgd97hKnA,16277
|
|
@@ -296,8 +296,8 @@ snowflake/cli/api/utils/path_utils.py,sha256=OgR7cwbHXqP875RgPJGrAvDC1RRTU-2-Yss
|
|
|
296
296
|
snowflake/cli/api/utils/python_api_utils.py,sha256=wTNxXrma78wPvBz-Jo-ixNtP8ZjDCDh4TvciEnhYIAM,300
|
|
297
297
|
snowflake/cli/api/utils/templating_functions.py,sha256=zu2oK1BEC9yyWtDx17Hr-VAYHvCtagaOdxIrm70JQys,4955
|
|
298
298
|
snowflake/cli/api/utils/types.py,sha256=fVKuls8axKSsBzPqWwrkwkwoXXmedqxNJKqfXrrGyBM,1190
|
|
299
|
-
snowflake_cli-3.
|
|
300
|
-
snowflake_cli-3.
|
|
301
|
-
snowflake_cli-3.
|
|
302
|
-
snowflake_cli-3.
|
|
303
|
-
snowflake_cli-3.
|
|
299
|
+
snowflake_cli-3.12.0.dist-info/METADATA,sha256=H7BCM5QUlhb6EG8dPm6oGy1SZYtMTDtRmAjD6EJTLhE,18489
|
|
300
|
+
snowflake_cli-3.12.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
301
|
+
snowflake_cli-3.12.0.dist-info/entry_points.txt,sha256=6QmSI0wUX6p7f-dGvrPdswlQyVAVGi1AtOUbE8X6bho,58
|
|
302
|
+
snowflake_cli-3.12.0.dist-info/licenses/LICENSE,sha256=mJMA3Uz2AbjU_kVggo1CAx01XhBsI7BSi2H7ggUg_-c,11344
|
|
303
|
+
snowflake_cli-3.12.0.dist-info/RECORD,,
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2024 Snowflake Inc.
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
from __future__ import annotations
|
|
15
|
-
|
|
16
|
-
from typing import List, Literal, Optional, TypeVar
|
|
17
|
-
|
|
18
|
-
from pydantic import Field, field_validator
|
|
19
|
-
from snowflake.cli.api.cli_global_context import get_cli_context
|
|
20
|
-
from snowflake.cli.api.entities.common import EntityBase, attach_spans_to_entity_actions
|
|
21
|
-
from snowflake.cli.api.exceptions import CliError
|
|
22
|
-
from snowflake.cli.api.project.schemas.entities.common import (
|
|
23
|
-
Artifacts,
|
|
24
|
-
EntityModelBaseWithArtifacts,
|
|
25
|
-
PathMapping,
|
|
26
|
-
)
|
|
27
|
-
from snowflake.cli.api.project.schemas.updatable_model import (
|
|
28
|
-
DiscriminatorField,
|
|
29
|
-
)
|
|
30
|
-
from snowflake.cli.api.secure_path import SecurePath
|
|
31
|
-
|
|
32
|
-
T = TypeVar("T")
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
MANIFEST_FILE_NAME = "manifest.yml"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class DCMProjectEntityModel(EntityModelBaseWithArtifacts):
|
|
39
|
-
type: Literal["dcm"] = DiscriminatorField() # noqa: A003
|
|
40
|
-
stage: Optional[str] = Field(
|
|
41
|
-
title="Stage in which the DCM Project artifacts will be stored", default=None
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
@field_validator("artifacts")
|
|
45
|
-
@classmethod
|
|
46
|
-
def transform_artifacts(cls, orig_artifacts: Artifacts) -> List[PathMapping]:
|
|
47
|
-
if not (
|
|
48
|
-
SecurePath(get_cli_context().project_root) / MANIFEST_FILE_NAME
|
|
49
|
-
).exists():
|
|
50
|
-
raise CliError(
|
|
51
|
-
f"{MANIFEST_FILE_NAME} was not found in project root directory"
|
|
52
|
-
)
|
|
53
|
-
orig_artifacts.append(PathMapping(src=MANIFEST_FILE_NAME))
|
|
54
|
-
return super().transform_artifacts(orig_artifacts)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
@attach_spans_to_entity_actions(entity_name="dcm")
|
|
58
|
-
class DCMProjectEntity(EntityBase[DCMProjectEntityModel]):
|
|
59
|
-
"""Placeholder for project entity"""
|
|
@@ -1,331 +0,0 @@
|
|
|
1
|
-
import enum
|
|
2
|
-
import re
|
|
3
|
-
import time
|
|
4
|
-
from dataclasses import dataclass
|
|
5
|
-
from datetime import datetime
|
|
6
|
-
from typing import Any, Dict, Generator, Iterable, List, Tuple
|
|
7
|
-
from urllib.parse import urlencode
|
|
8
|
-
|
|
9
|
-
from snowflake.cli._app.printing import print_result
|
|
10
|
-
from snowflake.cli.api.output.types import CollectionResult, QueryResult
|
|
11
|
-
from snowflake.connector import SnowflakeConnection
|
|
12
|
-
|
|
13
|
-
VALID_UUID_RE = re.compile(
|
|
14
|
-
r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class CommandType(enum.Enum):
|
|
19
|
-
QUERIES = "queries"
|
|
20
|
-
UNKNOWN = "unknown"
|
|
21
|
-
URL = "url"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class SnowSQLCommand:
|
|
25
|
-
def execute(self, connection: SnowflakeConnection):
|
|
26
|
-
"""Executes command and prints the result."""
|
|
27
|
-
raise NotImplementedError
|
|
28
|
-
|
|
29
|
-
@classmethod
|
|
30
|
-
def from_args(cls, args, kwargs) -> "CompileCommandResult":
|
|
31
|
-
"""Validates arguments and creates command ready for execution."""
|
|
32
|
-
raise NotImplementedError
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def _print_result_to_stdout(headers: Iterable[str], rows: Iterable[Iterable[Any]]):
|
|
36
|
-
formatted_rows: Generator[Dict[str, Any], None, None] = (
|
|
37
|
-
{key: value for key, value in zip(headers, row)} for row in rows
|
|
38
|
-
)
|
|
39
|
-
print_result(CollectionResult(formatted_rows))
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
@dataclass
|
|
43
|
-
class CompileCommandResult:
|
|
44
|
-
command: SnowSQLCommand | None = None
|
|
45
|
-
error_message: str | None = None
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
@dataclass
|
|
49
|
-
class QueriesCommand(SnowSQLCommand):
|
|
50
|
-
help_mode: bool = False
|
|
51
|
-
from_current_session: bool = False
|
|
52
|
-
amount: int = 25
|
|
53
|
-
user: str | None = None
|
|
54
|
-
warehouse: str | None = None
|
|
55
|
-
start_timestamp_ms: int | None = None
|
|
56
|
-
end_timestamp_ms: int | None = None
|
|
57
|
-
duration: str | None = None
|
|
58
|
-
stmt_type: str | None = None
|
|
59
|
-
status: str | None = None
|
|
60
|
-
|
|
61
|
-
def execute(self, connection: SnowflakeConnection) -> None:
|
|
62
|
-
if self.help_mode:
|
|
63
|
-
self._execute_help()
|
|
64
|
-
else:
|
|
65
|
-
self._execute_queries(connection)
|
|
66
|
-
|
|
67
|
-
def _execute_help(self):
|
|
68
|
-
headers = ["FILTER", "ARGUMENT", "DEFAULT"]
|
|
69
|
-
filters = [
|
|
70
|
-
["amount", "integer", "25"],
|
|
71
|
-
["status", "string", "any"],
|
|
72
|
-
["warehouse", "string", "any"],
|
|
73
|
-
["user", "string", "any"],
|
|
74
|
-
[
|
|
75
|
-
"start_date",
|
|
76
|
-
"datetime in ISO format (for example YYYY-MM-DDTHH:mm:ss.sss)",
|
|
77
|
-
"any",
|
|
78
|
-
],
|
|
79
|
-
[
|
|
80
|
-
"end_date",
|
|
81
|
-
"datetime in ISO format (for example YYYY-MM-DDTHH:mm:ss.sss)",
|
|
82
|
-
"any",
|
|
83
|
-
],
|
|
84
|
-
["start", "timestamp in milliseconds (integer)", "any"],
|
|
85
|
-
["end", "timestamp in milliseconds (integer)", "any"],
|
|
86
|
-
["type", "string", "any"],
|
|
87
|
-
["duration", "time in milliseconds", "any"],
|
|
88
|
-
["session", "No arguments", "any"],
|
|
89
|
-
]
|
|
90
|
-
_print_result_to_stdout(headers, filters)
|
|
91
|
-
|
|
92
|
-
def _execute_queries(self, connection: SnowflakeConnection) -> None:
|
|
93
|
-
url_parameters = {
|
|
94
|
-
"_dc": f"{time.time()}",
|
|
95
|
-
"includeDDL": "false",
|
|
96
|
-
"max": self.amount,
|
|
97
|
-
}
|
|
98
|
-
if self.user:
|
|
99
|
-
url_parameters["user"] = self.user
|
|
100
|
-
if self.warehouse:
|
|
101
|
-
url_parameters["wh"] = self.warehouse
|
|
102
|
-
if self.start_timestamp_ms:
|
|
103
|
-
url_parameters["start"] = self.start_timestamp_ms
|
|
104
|
-
if self.end_timestamp_ms:
|
|
105
|
-
url_parameters["end"] = self.end_timestamp_ms
|
|
106
|
-
if self.duration:
|
|
107
|
-
url_parameters["min_duration"] = self.duration
|
|
108
|
-
if self.from_current_session:
|
|
109
|
-
url_parameters["session_id"] = connection.session_id
|
|
110
|
-
if self.status:
|
|
111
|
-
url_parameters["subset"] = self.status
|
|
112
|
-
if self.stmt_type:
|
|
113
|
-
url_parameters["stmt_type"] = self.stmt_type
|
|
114
|
-
|
|
115
|
-
url = "/monitoring/queries?" + urlencode(url_parameters)
|
|
116
|
-
ret = connection.rest.request(url=url, method="get", client="rest")
|
|
117
|
-
if ret.get("data") and ret["data"].get("queries"):
|
|
118
|
-
_result: Generator[Tuple[str, str, str, str], None, None] = (
|
|
119
|
-
(
|
|
120
|
-
query["id"],
|
|
121
|
-
query["sqlText"],
|
|
122
|
-
query["state"],
|
|
123
|
-
query["totalDuration"],
|
|
124
|
-
)
|
|
125
|
-
for query in ret["data"]["queries"]
|
|
126
|
-
)
|
|
127
|
-
_print_result_to_stdout(
|
|
128
|
-
["QUERY ID", "SQL TEXT", "STATUS", "DURATION_MS"], _result
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
@classmethod
|
|
132
|
-
def from_args(cls, args: List[str], kwargs: Dict[str, Any]) -> CompileCommandResult:
|
|
133
|
-
if "help" in args:
|
|
134
|
-
return CompileCommandResult(command=cls(help_mode=True))
|
|
135
|
-
|
|
136
|
-
# "session" is set by default if no other arguments are provided
|
|
137
|
-
from_current_session = "session" in args or not kwargs
|
|
138
|
-
amount = kwargs.pop("amount", "25")
|
|
139
|
-
if not amount.isdigit():
|
|
140
|
-
return CompileCommandResult(
|
|
141
|
-
error_message=f"Invalid argument passed to 'amount' filter: {amount}"
|
|
142
|
-
)
|
|
143
|
-
user = kwargs.pop("user", None)
|
|
144
|
-
warehouse = kwargs.pop("warehouse", None)
|
|
145
|
-
duration = kwargs.pop("duration", None)
|
|
146
|
-
|
|
147
|
-
start_timestamp_ms = kwargs.pop("start", None)
|
|
148
|
-
if start_timestamp_ms:
|
|
149
|
-
try:
|
|
150
|
-
start_timestamp_ms = int(start_timestamp_ms)
|
|
151
|
-
except ValueError:
|
|
152
|
-
return CompileCommandResult(
|
|
153
|
-
error_message=f"Invalid argument passed to 'start' filter: {start_timestamp_ms}"
|
|
154
|
-
)
|
|
155
|
-
end_timestamp_ms = kwargs.pop("end", None)
|
|
156
|
-
if end_timestamp_ms:
|
|
157
|
-
try:
|
|
158
|
-
end_timestamp_ms = int(end_timestamp_ms)
|
|
159
|
-
except ValueError:
|
|
160
|
-
return CompileCommandResult(
|
|
161
|
-
error_message=f"Invalid argument passed to 'end' filter: {end_timestamp_ms}"
|
|
162
|
-
)
|
|
163
|
-
|
|
164
|
-
start_date = kwargs.pop("start_date", None)
|
|
165
|
-
if start_date:
|
|
166
|
-
if start_timestamp_ms:
|
|
167
|
-
return CompileCommandResult(
|
|
168
|
-
error_message=f"'start_date' filter cannot be used with 'start' filter"
|
|
169
|
-
)
|
|
170
|
-
try:
|
|
171
|
-
seconds = datetime.fromisoformat(start_date).timestamp()
|
|
172
|
-
start_timestamp_ms = int(seconds * 1000) # convert to milliseconds
|
|
173
|
-
except ValueError:
|
|
174
|
-
return CompileCommandResult(
|
|
175
|
-
error_message=f"Invalid date format passed to 'start_date' filter: {start_date}"
|
|
176
|
-
)
|
|
177
|
-
end_date = kwargs.pop("end_date", None)
|
|
178
|
-
if end_date:
|
|
179
|
-
if end_timestamp_ms:
|
|
180
|
-
return CompileCommandResult(
|
|
181
|
-
error_message=f"'end_date' filter cannot be used with 'end' filter"
|
|
182
|
-
)
|
|
183
|
-
try:
|
|
184
|
-
seconds = datetime.fromisoformat(end_date).timestamp()
|
|
185
|
-
end_timestamp_ms = int(seconds * 1000) # convert to milliseconds
|
|
186
|
-
except ValueError:
|
|
187
|
-
return CompileCommandResult(
|
|
188
|
-
error_message=f"Invalid date format passed to 'end_date' filter: {end_date}"
|
|
189
|
-
)
|
|
190
|
-
|
|
191
|
-
stmt_type = kwargs.pop("type", None)
|
|
192
|
-
if stmt_type:
|
|
193
|
-
stmt_type = stmt_type.upper()
|
|
194
|
-
if stmt_type not in [
|
|
195
|
-
"ANY",
|
|
196
|
-
"SELECT",
|
|
197
|
-
"INSERT",
|
|
198
|
-
"UPDATE",
|
|
199
|
-
"DELETE",
|
|
200
|
-
"MERGE",
|
|
201
|
-
"MULTI_TABLE_INSERT",
|
|
202
|
-
"COPY",
|
|
203
|
-
"COMMIT",
|
|
204
|
-
"ROLLBACK",
|
|
205
|
-
"BEGIN_TRANSACTION",
|
|
206
|
-
"SHOW",
|
|
207
|
-
"GRANT",
|
|
208
|
-
"CREATE",
|
|
209
|
-
"ALTER",
|
|
210
|
-
]:
|
|
211
|
-
return CompileCommandResult(
|
|
212
|
-
error_message=f"Invalid argument passed to 'type' filter: {stmt_type}"
|
|
213
|
-
)
|
|
214
|
-
|
|
215
|
-
status = kwargs.pop("status", None)
|
|
216
|
-
if status:
|
|
217
|
-
status = status.upper()
|
|
218
|
-
if status not in [
|
|
219
|
-
"RUNNING",
|
|
220
|
-
"SUCCEEDED",
|
|
221
|
-
"FAILED",
|
|
222
|
-
"BLOCKED",
|
|
223
|
-
"QUEUED",
|
|
224
|
-
"ABORTED",
|
|
225
|
-
]:
|
|
226
|
-
return CompileCommandResult(
|
|
227
|
-
error_message=f"Invalid argument passed to 'status' filter: {status}"
|
|
228
|
-
)
|
|
229
|
-
|
|
230
|
-
for arg in args:
|
|
231
|
-
if arg.lower() not in ["session", "help"]:
|
|
232
|
-
return CompileCommandResult(
|
|
233
|
-
error_message=f"Invalid argument passed to 'queries' command: {arg}"
|
|
234
|
-
)
|
|
235
|
-
if kwargs:
|
|
236
|
-
key, value = kwargs.popitem()
|
|
237
|
-
return CompileCommandResult(
|
|
238
|
-
error_message=f"Invalid argument passed to 'queries' command: {key}={value}"
|
|
239
|
-
)
|
|
240
|
-
|
|
241
|
-
return CompileCommandResult(
|
|
242
|
-
command=cls(
|
|
243
|
-
help_mode=False,
|
|
244
|
-
from_current_session=from_current_session,
|
|
245
|
-
amount=int(amount),
|
|
246
|
-
user=user,
|
|
247
|
-
warehouse=warehouse,
|
|
248
|
-
start_timestamp_ms=start_timestamp_ms,
|
|
249
|
-
end_timestamp_ms=end_timestamp_ms,
|
|
250
|
-
duration=duration,
|
|
251
|
-
stmt_type=stmt_type,
|
|
252
|
-
status=status,
|
|
253
|
-
)
|
|
254
|
-
)
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
def _validate_only_arg_is_query_id(
|
|
258
|
-
command_name: str, args: List[str], kwargs: Dict[str, Any]
|
|
259
|
-
) -> str | None:
|
|
260
|
-
if kwargs:
|
|
261
|
-
key, value = kwargs.popitem()
|
|
262
|
-
return f"Invalid argument passed to '{command_name}' command: {key}={value}"
|
|
263
|
-
if len(args) != 1:
|
|
264
|
-
amount = "Too many" if args else "No"
|
|
265
|
-
return f"{amount} arguments passed to '{command_name}' command. Usage: `!{command_name} <query id>`"
|
|
266
|
-
|
|
267
|
-
qid = args[0]
|
|
268
|
-
if not VALID_UUID_RE.match(qid):
|
|
269
|
-
return f"Invalid query ID passed to '{command_name}' command: {qid}"
|
|
270
|
-
|
|
271
|
-
return None
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
@dataclass
|
|
275
|
-
class ResultCommand(SnowSQLCommand):
|
|
276
|
-
query_id: str
|
|
277
|
-
|
|
278
|
-
def execute(self, connection: SnowflakeConnection):
|
|
279
|
-
cursor = connection.cursor()
|
|
280
|
-
cursor.query_result(self.query_id)
|
|
281
|
-
print_result(QueryResult(cursor=cursor))
|
|
282
|
-
|
|
283
|
-
@classmethod
|
|
284
|
-
def from_args(cls, args, kwargs) -> CompileCommandResult:
|
|
285
|
-
error_msg = _validate_only_arg_is_query_id("result", args, kwargs)
|
|
286
|
-
if error_msg:
|
|
287
|
-
return CompileCommandResult(error_message=error_msg)
|
|
288
|
-
return CompileCommandResult(command=cls(args[0]))
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
@dataclass
|
|
292
|
-
class AbortCommand(SnowSQLCommand):
|
|
293
|
-
query_id: str
|
|
294
|
-
|
|
295
|
-
def execute(self, connection: SnowflakeConnection):
|
|
296
|
-
cursor = connection.cursor()
|
|
297
|
-
cursor.execute(f"SELECT SYSTEM$CANCEL_QUERY('{self.query_id}')")
|
|
298
|
-
print_result(QueryResult(cursor=cursor))
|
|
299
|
-
|
|
300
|
-
@classmethod
|
|
301
|
-
def from_args(cls, args, kwargs) -> CompileCommandResult:
|
|
302
|
-
error_msg = _validate_only_arg_is_query_id("abort", args, kwargs)
|
|
303
|
-
if error_msg:
|
|
304
|
-
return CompileCommandResult(error_message=error_msg)
|
|
305
|
-
return CompileCommandResult(command=cls(args[0]))
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
def compile_snowsql_command(command: str, cmd_args: List[str]):
|
|
309
|
-
"""Parses command into SQL query"""
|
|
310
|
-
args = []
|
|
311
|
-
kwargs = {}
|
|
312
|
-
for cmd_arg in cmd_args:
|
|
313
|
-
if "=" not in cmd_arg:
|
|
314
|
-
args.append(cmd_arg)
|
|
315
|
-
else:
|
|
316
|
-
key, val = cmd_arg.split("=", maxsplit=1)
|
|
317
|
-
if key in kwargs:
|
|
318
|
-
return CompileCommandResult(
|
|
319
|
-
error_message=f"duplicated argument '{key}' for command '{command}'",
|
|
320
|
-
)
|
|
321
|
-
kwargs[key] = val
|
|
322
|
-
|
|
323
|
-
match command.lower():
|
|
324
|
-
case "!queries":
|
|
325
|
-
return QueriesCommand.from_args(args, kwargs)
|
|
326
|
-
case "!result":
|
|
327
|
-
return ResultCommand.from_args(args, kwargs)
|
|
328
|
-
case "!abort":
|
|
329
|
-
return AbortCommand.from_args(args, kwargs)
|
|
330
|
-
case _:
|
|
331
|
-
return CompileCommandResult(error_message=f"Unknown command '{command}'")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|