Skip to content

Commit

Permalink
removed function
Browse files Browse the repository at this point in the history
  • Loading branch information
neelasha23 committed Dec 31, 2023
1 parent 6accc2d commit a1988c5
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/sql/magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

import warnings
import shlex
from jinja2 import Template
import sql.connection
import sql.parse
from sql.run.run import run_statements
Expand All @@ -41,7 +40,7 @@
from sql.magic_cmd import SqlCmdMagic
from sql._patch import patch_ipython_usage_error
from sql import util
from sql.util import pretty_print
from sql.util import pretty_print, expand_args
from sql.error_handler import handle_exception
from sql._current import _set_sql_magic

Expand Down Expand Up @@ -403,14 +402,15 @@ def interactive_execute_wrapper(**kwargs):

# save globals and locals so they can be referenced in bind vars
user_ns = self.shell.user_ns.copy()
print(type(self.shell.user_ns))
user_ns.update(local_ns)

command = SQLCommand(self, user_ns, line, cell)
# args.line: contains the line after the magic with all options removed

args = command.args

util.expand_args(args, user_ns, ["section", "close", "alias", "save"])
expand_args(args, user_ns, ["section", "close", "alias", "save"])

if args.section and args.alias:
raise exceptions.UsageError(
Expand Down Expand Up @@ -628,15 +628,6 @@ def interactive_execute_wrapper(**kwargs):

legal_sql_identifier = re.compile(r"^[A-Za-z0-9#_$]+")

@staticmethod
def _args_expand(args, user_ns):
attributes_to_expand = ["section", "close", "alias", "save"]

for attribute in attributes_to_expand:
value = getattr(args, attribute)
if value:
setattr(args, attribute, Template(value).render(user_ns))

@modify_exceptions
def _persist_dataframe(
self, raw, conn, user_ns, append=False, index=True, replace=False
Expand Down

0 comments on commit a1988c5

Please sign in to comment.