diff options
author | Georgy Frolov <gosha@fro.lv> | 2021-03-12 21:16:14 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-12 10:16:14 -0800 |
commit | a017fa96bf5495be7efc0112b87e0fff20ee7b1d (patch) | |
tree | 8fa61b2a5b2c16d1e66c0daf1f4b994a93502e49 | |
parent | e009995e9f890cb75e8d60fa62166a1baeccb809 (diff) |
fix IPython magic (#1253)
-rw-r--r-- | changelog.rst | 1 | ||||
-rw-r--r-- | pgcli/magic.py | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/changelog.rst b/changelog.rst index 2c5d2cd4..5f270c3e 100644 --- a/changelog.rst +++ b/changelog.rst @@ -14,6 +14,7 @@ Bug fixes: * Fix issue where `syntax_style` config value would not have any effect. (#1212) * Fix crash because of not found `InputMode.REPLACE_SINGLE` with prompt-toolkit < 3.0.6 * Fix comments being lost in config when saving a named query. (#1240) +* Fix IPython magic for ipython-sql >= 0.4.0 3.1.0 ===== diff --git a/pgcli/magic.py b/pgcli/magic.py index c2b60aa0..6e58f28b 100644 --- a/pgcli/magic.py +++ b/pgcli/magic.py @@ -25,7 +25,11 @@ def pgcli_line_magic(line): if hasattr(sql.connection.Connection, "get"): conn = sql.connection.Connection.get(parsed["connection"]) else: - conn = sql.connection.Connection.set(parsed["connection"]) + try: + conn = sql.connection.Connection.set(parsed["connection"]) + # a new positional argument was added to Connection.set in version 0.4.0 of ipython-sql + except TypeError: + conn = sql.connection.Connection.set(parsed["connection"], False) try: # A corresponding pgcli object already exists |