public inbox for [email protected]
help / color / mirror / Atom feedFrom: Pradip Parkale <[email protected]>
To: Aditya Toshniwal <[email protected]>
To: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin][RM6520]: pgAdmin4 v 5.3 text export error
Date: Mon, 14 Jun 2021 15:37:12 +0530
Message-ID: <CAJ9T6SspOyknEZhG7MyCWmFt=bBYcrhMNkCxs2kCaXAQiQSOVA@mail.gmail.com> (raw)
In-Reply-To: <CAM9w-_kyf8reg8pw+qa=CaRKiU0i5Vfmyj34BSDSTXB6dP8w4w@mail.gmail.com>
References: <CAJ9T6Su+ib=bZ1EdHbD=HPfA6xBi0-N3RZ5dwsU6dReT2njeaQ@mail.gmail.com>
<CAM9w-_kyf8reg8pw+qa=CaRKiU0i5Vfmyj34BSDSTXB6dP8w4w@mail.gmail.com>
Hi Aditya and Akshay,
Please find the updated patch. I have changed the variable name "data" to
'numeric_cols'.
On Fri, Jun 11, 2021 at 7:38 PM Aditya Toshniwal <
[email protected]> wrote:
> Hi Pradip,
>
> Just did a go through to your patch.
> The variable "data" which you've formed, will be computed for every row
> even though columns won't change. You should move it up and pass it to gen
> directly. This will save repeated computations.
> Secondly, it should not be named as data. It can be like - numeric_cols or
> numeric_keys.
>
> On Fri, Jun 11, 2021 at 7:17 PM Pradip Parkale <
> [email protected]> wrote:
>
>> Hi Hackers,
>>
>> Please find the attached patch for #6520.Added check to typecast the
>> numeric data while downloading the data in CSV format.
>>
>> --
>> Thanks & Regards,
>> Pradip Parkale
>> Software Engineer | EnterpriseDB Corporation
>>
>
>
> --
> Thanks,
> Aditya Toshniwal
> pgAdmin hacker | Sr. Software Engineer | *edbpostgres.com*
> <http://edbpostgres.com;
> "Don't Complain about Heat, Plant a TREE"
>
--
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation
Attachments:
[application/octet-stream] RM6520_v2.patch (1.2K, 3-RM6520_v2.patch)
download | inline diff:
diff --git a/web/pgadmin/utils/driver/psycopg2/typecast.py b/web/pgadmin/utils/driver/psycopg2/typecast.py
index 0250e9316..34b2779e3 100644
--- a/web/pgadmin/utils/driver/psycopg2/typecast.py
+++ b/web/pgadmin/utils/driver/psycopg2/typecast.py
@@ -201,17 +201,17 @@ def register_string_typecasters(connection):
def numeric_typecasters(results, conn_obj):
# This function is to convert pg types to numeic type caster
- data = []
+ numeric_cols = []
for obj_type in conn_obj.column_info:
if obj_type['type_code'] in TO_STRING_NUMERIC_DATATYPES:
- data.append(obj_type['name'])
+ numeric_cols.append(obj_type['name'])
for result in results:
for key, value in result.items():
if isinstance(result[key],
- str) and key in data and not value.isdigit():
+ str) and key in numeric_cols and not value.isdigit():
result[key] = float(result[key])
- elif isinstance(result[key], str) and key in data:
+ elif isinstance(result[key], str) and key in numeric_cols:
result[key] = int(result[key])
return results
view thread (3+ messages)
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], [email protected], [email protected]
Subject: Re: [pgAdmin][RM6520]: pgAdmin4 v 5.3 text export error
In-Reply-To: <CAJ9T6SspOyknEZhG7MyCWmFt=bBYcrhMNkCxs2kCaXAQiQSOVA@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