File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -705,7 +705,7 @@ def get_query_type(command: str):
705705
706706def set_configs (ip , file_path , alternate_path ):
707707 """Set user defined SqlMagic configuration settings"""
708- sql = ip .find_cell_magic ("sql " ).__self__
708+ sql = ip .find_cell_magic ("jupysql " ).__self__
709709 user_configs , loaded_from = util .get_user_configs (file_path , alternate_path )
710710 default_configs = util .get_default_configs (sql )
711711 table_rows = []
Original file line number Diff line number Diff line change 2323from sql .run .resultset import ResultSet
2424from sql import magic
2525from sql .warnings import JupySQLQuotedNamedParametersWarning
26+ from sql ._testing import TestingShell
27+ from sql .magic import load_ipython_extension
2628
2729
2830from conftest import runsql
@@ -2767,3 +2769,21 @@ def test_disabled_named_parameters_shows_disabled_warning(ip):
27672769 )
27682770
27692771 assert expected_warning in str (excinfo .value )
2772+
2773+
2774+ def test_databricks_sql_magic_disabled (monkeypatch ):
2775+ monkeypatch .setenv ("DATABRICKS_RUNTIME_VERSION" , "10.0.0" )
2776+ ip = TestingShell .preconfigured_shell ()
2777+ load_ipython_extension (ip )
2778+
2779+ ip .run_cell ("%jupysql duckdb://" )
2780+ ip .run_cell ("%jupysql select 1" )
2781+
2782+ with pytest .raises (UsageError ) as excinfo_line :
2783+ ip .run_cell ("%sql select 1" )
2784+
2785+ with pytest .raises (UsageError ) as excinfo_cell :
2786+ ip .run_cell ("%%sql\n select 1" )
2787+
2788+ assert "Line magic function `%sql` not found" in str (excinfo_line .value )
2789+ assert "Cell magic `%%sql` not found" in str (excinfo_cell .value )
You can’t perform that action at this time.
0 commit comments