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