public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin4][Patch] - Fix for Sqlalchemy Operational error
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin4][Patch] - Fix for Sqlalchemy Operational error
@ 2020-09-30 10:08 Khushboo Vashi <[email protected]>
2020-10-01 08:01 ` Re: [pgAdmin4][Patch] - Fix for Sqlalchemy Operational error Akshay Joshi <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Khushboo Vashi @ 2020-09-30 10:08 UTC (permalink / raw)
To: pgadmin-hackers
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).")
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin4][Patch] - Fix for Sqlalchemy Operational error
2020-09-30 10:08 [pgAdmin4][Patch] - Fix for Sqlalchemy Operational error Khushboo Vashi <[email protected]>
@ 2020-10-01 08:01 ` Akshay Joshi <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2020-10-01 08:01 UTC (permalink / raw)
To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers
Thanks, patch applied.
On Wed, Sep 30, 2020 at 3:38 PM Khushboo Vashi <
[email protected]> wrote:
> 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
>
--
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Sr. Software Architect*
*EDB Postgres <http://edbpostgres.com>*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2020-10-01 08:01 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30 10:08 [pgAdmin4][Patch] - Fix for Sqlalchemy Operational error Khushboo Vashi <[email protected]>
2020-10-01 08:01 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox