Re: [GSoC][Patch] Automatic Mode Detection V1

From: Yosry Muhammad <yosrym93(at)gmail(dot)com>
To: Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>, Dave Page <dpage(at)pgadmin(dot)org>, pgadmin-hackers(at)postgresql(dot)org
Subject: Re: [GSoC][Patch] Automatic Mode Detection V1
Date: 2019-06-20 14:54:50
Message-ID: CAFSMqn9qsjRzyW3zO5MD2DYfdiyhsXR5J1+4GPr4TnQuEaYYDQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On Thu, Jun 20, 2019 at 7:49 AM Aditya Toshniwal <
aditya(dot)toshniwal(at)enterprisedb(dot)com> wrote:

> [forked the mail chain for code review]
> Hi Yosry,
>
> On Wed, Jun 19, 2019 at 5:24 PM Dave Page <dpage(at)pgadmin(dot)org> wrote:
>
>>
>> Aditya; can you do a quick code review please? Bear in mind it's a work
>> in progress and there are no docs or tests etc. yet.
>>
> Nice work there. :)
>
> I just had look on the code changes, and have few suggestions:
> 1) I found the code around primary key in the function
> check_for_updatable_resultset_and_primary_keys repeating. Try if you
> cpuld modify/reuse the get_primary_keys function.
> 2) The function name check_for_updatable_resultset_and_primary_keys could
> be shorter, something like check_updatabale_rset_pkeys. Same for
> __set_updatable_resultset_attributes to __set_updatable_rset_attr
> 3) You've used background: #f4f4f4; for .highlighted_grid_cells class.
> This should go to sqleditor.scss with appropriate color from
> web/pgadmin/static/scss/resources/_default.variables.scss. Hard coded color
> codes are highly discouraged.
> Otherwise, looks good (didn't run and check)
>
>>
>>
>
I shortened both function names and fixed the hard-coded color. For #1, in
the QueryToolCommand different processing of the primary keys occur in
is_query_resultset_updatable function, where the attribute number of the
primary keys is compared against columns and so. The only repeated part in
check_for_updatable_resultset_and_primary_keys is the part where pk_names
string is created in the required format (which is only a few lines of
code). I could factor it out to a utility function - takes primary_keys
dict and returns the pk_names string in the required format. What do you
think?

These changes (together with other changes that I am working on) will be
included in the next version of this patch.

Thanks !

--
*Yosry Muhammad Yosry*

Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class representative of CMP 2021.
https://www.linkedin.com/in/yosrym93/

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Andrew Coleman 2019-06-20 16:31:40 change to Docker entrypoint.sh
Previous Message Dave Page 2019-06-20 13:30:34 pgAdmin 4 commit: PEP-8 fixes.