public inbox for [email protected]
help / color / mirror / Atom feedFrom: Yosry Muhammad <[email protected]>
To: Aditya Toshniwal <[email protected]>
To: [email protected]
To: Dave Page <[email protected]>
Subject: Re: [GSoC][Patch] Automatic Mode Detection V1
Date: Wed, 26 Jun 2019 14:29:21 +0200
Message-ID: <CAFSMqn8-xNxGpcN7nwNhX+q9yQ2x5aSY7psmpudV+wR_TBsQJQ@mail.gmail.com> (raw)
In-Reply-To: <CAM9w-_=2GMSPnJPK=sfbDgO_jXoEFf4Q6SVodZrvNeMVNRkpPQ@mail.gmail.com>
References: <CAFSMqn_dG6Ecn2z1to5jSFndyu0Y6QQ9A+RALo0Rr2YucYRogQ@mail.gmail.com>
<CAFSMqn_n4kMF-BYHj7mVpR1oe5-ztZHV+XjVcM5Bc-Tj=srSBA@mail.gmail.com>
<CA+OCxox1FEypF6y46DkSy3gZ77j7CBRa90kacMBF+qULNCcfcw@mail.gmail.com>
<CAFSMqn--z1ro3eG0FRmLSyRYqa-CDb+H3PehMYbTd=i3jyBPtA@mail.gmail.com>
<CA+OCxoz=pZjkffHQm5GiP=n1F66K9XKqk=LTt1eO-HP0jFPHkQ@mail.gmail.com>
<CAFSMqn9So7MQ729EM0CD9CVXG6q=p77r0NvxUryFAtFqaunh-Q@mail.gmail.com>
<CA+OCxozpBQUfmBMuZ8EXN2NRM4Y5pyCmY3SOq6AnbC5VeLG70A@mail.gmail.com>
<CAM9w-_nUKgKScDtraiX+ALKDcO5GP+cA12yzNFa9PQ-CTJWs9w@mail.gmail.com>
<CAFSMqn9qsjRzyW3zO5MD2DYfdiyhsXR5J1+4GPr4TnQuEaYYDQ@mail.gmail.com>
<CAFSMqn87dZ_uKjk6UEwNd=wUM4NvWEc7d1Tqs5yj-MkaVK94Kw@mail.gmail.com>
<CAM9w-_mRyY+Ljuy0Wvq5bUVXMnqO-Tv1RYeBjFgyerkkYg6efw@mail.gmail.com>
<CAFSMqn-62TQoHT-8fKDq7cWhofQ8XtLbHQV5q++u+NQw=dXDOg@mail.gmail.com>
<CAM9w-_n-hp8XwQM2QhiMu5dLumuQxMhU+ZFzEGiA6Ws+sMedaQ@mail.gmail.com>
<CA+OCxoxd+S-qgK0v=6EeJrXNK3f5AJX3A=kuZD0K3jhYnFnPBw@mail.gmail.com>
<CAM9w-_kqda=eN4qcY2X9sir0KEWNN7U_3Y-2+o-GW4TCPSs0uA@mail.gmail.com>
<CAFSMqn9XU0f1G0KCiPPZSFTUiJuWpitYBoZyn9113TZG5M2+5w@mail.gmail.com>
<CAM9w-_nbQ0h8og71GyTYddOyRdg5PbPsE-VVwx5t9gOPvFduhQ@mail.gmail.com>
<CAM9w-_=2GMSPnJPK=sfbDgO_jXoEFf4Q6SVodZrvNeMVNRkpPQ@mail.gmail.com>
On Wed, Jun 26, 2019 at 11:46 AM Aditya Toshniwal <
[email protected]> wrote:
> Hi,
>
> On Wed, Jun 26, 2019 at 10:35 AM Aditya Toshniwal <
> [email protected]> wrote:
>
>>
>> My problem is not where to store the mogrified query, I can just replace
>>> the sql sent with the response to saving the data with the mogrified one.
>>> In order to produce the mogrified query in the first place I need a
>>> psycopg2.cursor object, but I only have access to a Connection object (the
>>> wrapper, not the actual psycopg2.connection object). Should I modify that
>>> wrapper Connection class to add a mogirfy function? or just get a cursor
>>> using the psycopg2.connection object like this: conn.conn.cursor() - which
>>> doesn't seem right. Thoughts?
>>>
>> That would be the way. But I think
>> web/pgadmin/utils/driver/psycopg2/cursor.py will be corrrect place to add
>> the mogrify function. Please note, psycopg2 does not support (,),% in
>> the parameter names. So if the column names has any of these characters,
>> mogrify might fail. Although it is handled with pgadmin_alias (line 493
>> - web/pgadmin/tools/sqleditor/__init__.py), please test this case as well.
>>
> You can also get the last executed SQL in psycopg2 -
> http://initd.org/psycopg/docs/cursor.html#cursor.query. May be this can
> be used.
>
The cursor wrapper class (DictCursor) is exclusively used by the connection
wrapper class (at web/pgadmin/utils/driver/psycopg2/connection.py) as a
cursor factory. I think the mogrify function will need to be implemented in
both classes, as the Connection class is the one that is used throughout
the code - no code uses cursors directly. What do you think?
The use of cursor.query will not be possible as this is a property of the
cursor, not the connection. I will need to call cursor.query on the exact
cursor that was used to execute the query, which is not accessible in this
case.
Thanks a lot for your help !
>>> Also, could you please help me with the selenium TimeoutException in the
>>> feature tests? 3 tests are failing because of that exception and I am not
>>> sure what is it related to. I am attaching the feature test log file in
>>> this email if you would like to take a look on it.
>>>
>> Can you check on latest chrome and chromdriver. You can check the
>> chromedriver version as below. Your venv should have the chromedriver
>> binary.
>>
>> (pypg37) laptop207:pgadmin4 adityatoshniwal$ chromedriver --version
>> ChromeDriver 75.0.3770.8
>> (681f24ea911fe754973dda2fdc6d2a2e159dd300-refs/branch-heads/3770@{#40})
>>
>>>
>>>
>>>
The version I have is actually 75.0.3770.90. Could the more recent version
be causing the problem ?
Thanks and regards.
--
*Yosry Muhammad Yosry*
Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class representative of CMP 2021.
https://www.linkedin.com/in/yosrym93/
view thread (27+ 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], [email protected], [email protected]
Subject: Re: [GSoC][Patch] Automatic Mode Detection V1
In-Reply-To: <CAFSMqn8-xNxGpcN7nwNhX+q9yQ2x5aSY7psmpudV+wR_TBsQJQ@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