Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iVXNG-000805-Fn for pgadmin-hackers@arkaria.postgresql.org; Fri, 15 Nov 2019 08:54:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iVXNE-0003nc-NH for pgadmin-hackers@arkaria.postgresql.org; Fri, 15 Nov 2019 08:54:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iVXNE-0003nV-By for pgadmin-hackers@lists.postgresql.org; Fri, 15 Nov 2019 08:54:36 +0000 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iVXNB-0006Xv-CQ for pgadmin-hackers@postgresql.org; Fri, 15 Nov 2019 08:54:35 +0000 Received: by mail-ot1-x32c.google.com with SMTP id r24so7394321otk.12 for ; Fri, 15 Nov 2019 00:54:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dBVYu5/2J4obytSsqkUsU40Y3XcK9nh07DdOkNAhBpQ=; b=q9eoiBZPgJWCsehQGkZ4NfAnmPBO1WvL05FIh/aD6Tin6llqE7RkA1Nehqj7VS45zV aLxLWtDbeaRRCjzM9VPODoL7c+Qs+ugeru3jpDAKv8UhZIeIG1jnU7BFy5x4w7GHDqgJ aJdt7FIUVet94nrfsyCO25ehzGMQybFI6SlzJwUC72IGSl3c181IwslWSBMb4PIzFFEl pdmyeeu2uUwN7c3hWQMQ1MiZX1gYHZajU1ZmDvrrX5OfOmrGzb9BDWGf+ywN7FD7ZeGf HgwaTruaVvQ9JjY/yBFUp1UEf0Ba7StLa6TqkKnGgCRBd4pTTqvJRMsohw02flWHPvO3 N2ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=dBVYu5/2J4obytSsqkUsU40Y3XcK9nh07DdOkNAhBpQ=; b=lVG7uLr85/1ra4L/Alo0bwtcl5Opfzvkn13IqX8w18WXqBFDmWHjI+37Y6q/dziYxz NmWqDPWwKOq7K+qZa4FZJLRR6H9Wm+DXWhDaP0PNSjWL9iNhNCbLNhF/rcoJ0LCsFkMB L1DImq1bFgyakNps3eLv88VaMZQg7vOW7glvO2zmWYIQfz/BUCusD/X1crd9IlDoCqn+ 93S3p8Aj/mnh13Li3UjpBrRfdkui3othn+LBRZ7PeO0uEEgkZwOOhb7njW4ZEY0rcodq N1myUDzYV4DS6cToYYiS3h/yyvx4ET/TLx6Pblr9gVgpzUjvRLcVkqF5WM0uFSFvUUcu JbFQ== X-Gm-Message-State: APjAAAVUoKpvBzByiabxtAbq4Q6OmRGRU03pbU94ztciTKvK1hpXFK3r enB1hyhbIydE6n/avJZ821J0hdd72fZtVLuAXZMkd+I/ew37X99bxxJTfcXQLTwAMWpqpTTjULv q5ZWbeoETeeBrwFNeaVCn1QzWVz+jj25up95ElumxybEOW30aABXE7FXORJO2lCJmYU4m7Twc7z 8p/78RqcdTGtgvbfZqJhad5/rWL7E+Mymr88yq7o6kr1GllY3E2KE= X-Google-Smtp-Source: APXvYqwPMHIGmxRjSfgBbQUQdy6GNFXdbsVqQz/w5zP35ZSnASHUyW4BYhi5s4WqjrYbDHG9tjIDggkAz3kP9kc4HJo= X-Received: by 2002:a9d:3476:: with SMTP id v109mr10516577otb.347.1573808070086; Fri, 15 Nov 2019 00:54:30 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Khushboo Vashi Date: Fri, 15 Nov 2019 14:24:21 +0530 Message-ID: Subject: Re: Refactored code for Table and its child nodes. To: Akshay Joshi Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000f66e8905975ebeba" X-CLOUD-SEC-AV-Info: edb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000f66e8905975ebeba Content-Type: text/plain; charset="UTF-8" Hi Akshay, On Thu, Nov 14, 2019 at 5:52 PM Akshay Joshi wrote: > Hi Khushboo > > Attached is the patch to fix Python 2.7 issue. > Looks good to me. Thanks, Khushboo > > On Thu, Nov 14, 2019 at 2:48 PM Khushboo Vashi < > khushboo.vashi@enterprisedb.com> wrote: > >> Hi Akshay, >> >> Everything works fine on Python 3 but not working on Python 2.7. >> Code refactoring looks good to me. >> >> Thanks, >> Khushboo >> >> On Wed, Nov 13, 2019 at 7:13 PM Akshay Joshi < >> akshay.joshi@enterprisedb.com> wrote: >> >>> Hi Hackers, >>> >>> For a couple of days, I was working on the code refactoring of Table and >>> it's child nodes. >>> >>> *Problem*: In pgAdmin4 child nodes of the table can be >>> created/modified from table dialog as well as from individual node. >>> For example: Primary Key constraint can be created/updated from tables as >>> well as from individual primary key node. >>> >>> After analyzing the code it seems that we have duplicate logic/functions >>> in '*tables/utils.py*' and '*__init__.py*' of the respective node. >>> >>> So because of the above-described problem, if there is a bug at one >>> place we need to fix it on both the places. >>> >>> *Purpose*: >>> >>> 1. Remove duplicate logic. >>> 2. Child node specific logic should be inside the child node and >>> table node gets the required information from the respective child node. >>> >>> *Solution*: >>> >>> 1. Create '*utils.py*' for each child node. >>> 2. Move the common logic from '*tables/utils.py*' and '*__init__.py*' >>> of the respective node to '*utils.py'.* >>> 3. Both table and its respective child access the functions from the >>> respective '*utils.py*'. >>> >>> >>> *Note*: Refactoring of *columns* node still remaining I'll start >>> working on it. >>> >>> Please review/test the patch thoroughly for tables and it's child nodes. >>> >>> -- >>> *Thanks & Regards* >>> *Akshay Joshi* >>> >>> *Sr. Software Architect* >>> *EnterpriseDB Software India Private Limited* >>> *Mobile: +91 976-788-8246* >>> >> > > -- > *Thanks & Regards* > *Akshay Joshi* > > *Sr. Software Architect* > *EnterpriseDB Software India Private Limited* > *Mobile: +91 976-788-8246* > --000000000000f66e8905975ebeba Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Akshay,

On Thu, Nov 14, 2019 at 5:52 PM Akshay Josh= i <akshay.joshi@enterpr= isedb.com> wrote:
Hi=C2=A0Khushboo

Attached is= the patch to fix Python 2.7 issue.
Looks good= to me.=C2=A0

Thanks,
Khushboo

On Thu, Nov 14, 2019 at 2:48 PM Khu= shboo Vashi <khushboo.vashi@enterprisedb.com> wrote:
Hi Akshay,=

Everything works fine on Python 3 but not working= on Python 2.7.
Code refactoring looks good to me.

=
Thanks,
Khushboo

<= div dir=3D"ltr" class=3D"gmail_attr">On Wed, Nov 13, 2019 at 7:13 PM Akshay= Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi Hackers,

For a couple=C2=A0of days, I was working on the code refactoring of T= able and it's child nodes.

Problem:=C2= =A0 In pgAdmin4 child nodes of the table can be created/modified from table= dialog as well as from individual node. For=C2=A0example: Primary=C2=A0Key= constraint can be created/updated from tables as well as from individual p= rimary key node.

After analyzing the code it seems= that we have duplicate logic/functions in 'tables/utils.py'= and '__init__.py' of the respective node.=C2=A0
<= br>
So because of the above-described problem, if there is a bug = at one place we need to fix it on both the places.=C2=A0=C2=A0
Purpose:=C2=A0
  1. Remove duplicate logic= .
  2. Child node specific logic should be inside the child node and tab= le node gets the required information from the respective child node.
  3. <= /ol>
Solution:
  1. Create 'utils.py' for each child node.
  2. Move the common logic from 'tab= les/utils.py' and '__init__.py' of the respective no= de to 'utils.py'.
  3. Both table and its respective chil= d access the functions from the respective=C2=A0'utils.py'.<= /li>

Note: Refactoring of columns node still remaining I'll start working on it.

<= div>Please review/test=C2=A0the patch thoroughly for tables and it's ch= ild nodes.

--
Thanks &= ; Regards
Akshay Joshi
Sr. Software Architect
<= /font>
EnterpriseDB Software India Private Li= mited
Mobile: +91 976-788-8246
=


--
Thanks & Regards
Akshay Joshi
<= font color=3D"#3333FF">Sr. Software Architect=
<= font color=3D"#000000" face=3D"arial, sans-serif">EnterpriseDB Software = India Private Limited
Mobile: +91 976-788-8246=
--000000000000f66e8905975ebeba--