public inbox for [email protected]
help / color / mirror / Atom feedFrom: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch] - Fix for Sqlalchemy Operational error
Date: Wed, 30 Sep 2020 15:38:12 +0530
Message-ID: <CAFOhELewn5n7XZ=aZcAz8A2WaXuaBAnaA_tdHeDwTX68KO84wQ@mail.gmail.com> (raw)
Hi,
Sqlalchemy gives an operational error with the SQL query with boolean
true/false for Python versions < 3.7. Please find the attached patch to fix
it.
Thanks,
Khushboo
Attachments:
[application/octet-stream] sqlite_boolean_fix.patch (2.5K, 3-sqlite_boolean_fix.patch)
download | inline diff:
diff --git a/web/migrations/versions/398697dc9550_.py b/web/migrations/versions/398697dc9550_.py
index c9651f546..93b0eb735 100644
--- a/web/migrations/versions/398697dc9550_.py
+++ b/web/migrations/versions/398697dc9550_.py
@@ -40,14 +40,14 @@ def upgrade():
""")
db.engine.execute("""
- INSERT INTO macros (id, alt, control, key, key_code) VALUES (1, false, true, '1', 49),
- (2, false, true, '2', 50), (3, false, true, '3', 51), (4, false, true, '4', 52),
- (5, false, true, '5', 53), (6, false, true, '6', 54), (7, false, true, '7', 55),
- (8, false, true, '8', 56), (9, false, true, '9', 57), (10, false, true, '0', 48),
- (11, true, false, 'F1', 112), (12, true, false, 'F2', 113), (13, true, false, 'F3', 114),
- (14, true, false, 'F4', 115), (15, true, false, 'F5', 116), (16, true, false, 'F6', 117),
- (17, true, false, 'F7', 118), (18, true, false, 'F8', 119), (19, true, false, 'F9', 120),
- (20, true, false, 'F10', 121), (21, true, false, 'F11', 122), (22, true, false, 'F12', 123);
+ INSERT INTO macros (id, alt, control, key, key_code) VALUES (1, 0, 1, '1', 49),
+ (2, 0, 1, '2', 50), (3, 0, 1, '3', 51), (4, 0, 1, '4', 52),
+ (5, 0, 1, '5', 53), (6, 0, 1, '6', 54), (7, 0, 1, '7', 55),
+ (8, 0, 1, '8', 56), (9, 0, 1, '9', 57), (10, 0, 1, '0', 48),
+ (11, 1, 0, 'F1', 112), (12, 1, 0, 'F2', 113), (13, 1, 0, 'F3', 114),
+ (14, 1, 0, 'F4', 115), (15, 1, 0, 'F5', 116), (16, 1, 0, 'F6', 117),
+ (17, 1, 0, 'F7', 118), (18, 1, 0, 'F8', 119), (19, 1, 0, 'F9', 120),
+ (20, 1, 0, 'F10', 121), (21, 1, 0, 'F11', 122), (22, 1, 0, 'F12', 123);
""")
diff --git a/web/pgadmin/tools/sqleditor/utils/macros.py b/web/pgadmin/tools/sqleditor/utils/macros.py
index 597d5f996..10ad95811 100644
--- a/web/pgadmin/tools/sqleditor/utils/macros.py
+++ b/web/pgadmin/tools/sqleditor/utils/macros.py
@@ -162,13 +162,13 @@ def update_macro(data, macro):
:param macro: macro
"""
- name = getattr(data, 'name', None)
- sql = getattr(data, 'sql', None)
+ name = data.get('name', None)
+ sql = data.get('sql', None)
- if name or sql and macro.sql and name is None:
+ if name or sql and macro.sql and 'name' in data and name is None:
return False, gettext(
"Could not find the required parameter (name).")
- elif name or sql and macro.name and sql is None:
+ elif name or sql and macro.name and 'sql' in data and sql is None:
return False, gettext(
"Could not find the required parameter (sql).")
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin4][Patch] - Fix for Sqlalchemy Operational error
In-Reply-To: <CAFOhELewn5n7XZ=aZcAz8A2WaXuaBAnaA_tdHeDwTX68KO84wQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox