Skip to content

Commit

Permalink
add no_var
Browse files Browse the repository at this point in the history
  • Loading branch information
neelasha23 committed Jan 25, 2024
1 parent 8b1068b commit 22fa04e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/sql/cmd/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def snippets(others, user_ns):
Implementation of `%sqlcmd snippets`
This function handles all the arguments related to %sqlcmd snippets, namely
listing stored snippets, and delete/ force delete/ force delete a snippet and
all its dependent snippets. It also uses the kernel namespace for expanding
all its dependent snippets. It also uses the kernel namespace for expanding
arguments declared as variables.
Expand Down
5 changes: 3 additions & 2 deletions src/sql/magic_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import argparse
import shlex

from IPython.core.magic import Magics, line_magic, magics_class
from IPython.core.magic import Magics, line_magic, magics_class, no_var_expand
from IPython.core.magic_arguments import argument, magic_arguments
from sql.inspect import support_only_sql_alchemy_connection
from sql.cmd.tables import tables
Expand Down Expand Up @@ -35,6 +35,7 @@ def error(self, message):
class SqlCmdMagic(Magics, Configurable):
"""%sqlcmd magic"""

@no_var_expand
@line_magic("sqlcmd")
@magic_arguments()
@argument("line", type=str, help="Command name")
Expand Down Expand Up @@ -128,7 +129,7 @@ def execute(self, cmd_name="", others="", cell="", local_ns=None):
}

cmd = router.get(cmd_name)
if cmd == "connect":
if cmd_name == "connect":
return cmd(others)
else:
return cmd(others, self.shell.user_ns.copy())

0 comments on commit 22fa04e

Please sign in to comment.