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 1iVBID-0001ZY-8c for pgadmin-hackers@arkaria.postgresql.org; Thu, 14 Nov 2019 09:19:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iVBHC-0004G3-9d for pgadmin-hackers@arkaria.postgresql.org; Thu, 14 Nov 2019 09:18:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iVBHB-0004Fw-NY for pgadmin-hackers@lists.postgresql.org; Thu, 14 Nov 2019 09:18:54 +0000 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iVBH6-0000BN-Tf for pgadmin-hackers@postgresql.org; Thu, 14 Nov 2019 09:18:51 +0000 Received: by mail-oi1-x22e.google.com with SMTP id e9so4627571oif.8 for ; Thu, 14 Nov 2019 01:18:48 -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=2/NewYDxVkKM7NS5ubMKDKCkYVIQq8FT2BrFFZw46cY=; b=MRxEi/wOlNlDHuwD53rZ5sm6t1B3WzMn1NiGKd+vqV536yObFgNX8topYKGf7z0iu/ SkRmYaUg0WLzAnuKRvYxkq5gPJtymmXDLOAL9KWkNuJ3fkViFQ/6Qi391PfjLHwQFLT8 t4w/5/Sa8lfNiptVV+uFJqizr+SiD/dWIGQONtBxFl9b1yYUTbvJrAT5qjAxY2tX7iVz 58OJksglLLj1fqv6xf+mtGY+Et60Bt9ez/v+4icPLODI3Bj6EbLITMcldvH/r5M2lbA5 YK9xY1Wf076v+9IKxM0cCtlUt7wUk7oag9WhSHtaILwjkcaTF+84kmQS+Qr5OO6vVFqL 2/hA== 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=2/NewYDxVkKM7NS5ubMKDKCkYVIQq8FT2BrFFZw46cY=; b=MVVDpwCC2K1vdGDDPQHI8xbC2WL0OleGgAvtaUD03+Sk/nj6bv0OKhJuNAEYtmIRsz pmTsnwY0hkAGI+q69DMpRQQ4ehm44qT3R/E8pHHN56nCP0GbUL0rvmT9h8w/7ovlS1q0 zU8blUtqbKAZDZNGWOVcFvKsI55LU+jk8HoIR2C+O4aasp6Z8bGZ5Ax5CZhMCD+vbflN XdME+4sHibsiQf9JWhWd1gFzOFVrUx3/YqVQAqozLvPDJ9fvnD3N0DdvuX2uJWxJ1zFi /l5cL4+pTfUmRPSQpSb8OIXx2CzKj0V75PdzeaDCG3/slwGW8QMzKR88jUYy/xzXtZvO 2sLg== X-Gm-Message-State: APjAAAUSNEoWkRZWxXXGIRxy8qND0j9q4udPTXDCEJtbvc2GRrJBieHG wKoRxkT8JEQ+hUrSd0wnbA0tMmWeogoAtxz8YTPLtc9zo6Nb1/m9vpbrO0GXJQeuhUdcTLtwatl 0kkIlwx3s5nep2lttgit6T7KEgMh7/Aevc39lIOHBxlEUQPpPLWOQY3ZiSmNUEwJEVud1zCveZn BTid9kRQgyqKf+XKbB47ZDIF53cd7Gwot4PSAotb1lZiioDJaZo1Y= X-Google-Smtp-Source: APXvYqxIk4W/Ug0xwWj97L/DyCt8tIVTQU75w/R7b5l+KOqFkf1BRbTUlGZEKl4zUQa2Xpf26Jq8nO3u5ZX7FvaLiZE= X-Received: by 2002:aca:4c14:: with SMTP id z20mr2804813oia.76.1573723126277; Thu, 14 Nov 2019 01:18:46 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Khushboo Vashi Date: Thu, 14 Nov 2019 14:48:37 +0530 Message-ID: Subject: Re: Refactored code for Table and its child nodes. To: Akshay Joshi Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000eac14605974af761" 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 --000000000000eac14605974af761 Content-Type: text/plain; charset="UTF-8" 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 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* > --000000000000eac14605974af761 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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,<= div>
For a couple=C2=A0of days, I was working on the code ref= actoring of Table and it's child nodes.

Pro= blem:=C2=A0 In pgAdmin4 child nodes of the table can be created/modifie= d from table dialog as well as from individual node. For=C2=A0example: Prim= ary=C2=A0Key constraint can be created/updated from tables as well as from = individual primary key node.

After analyzing the c= ode it seems that we have duplicate logic/functions in 'tables/utils= .py' and '__init__.py' of the respective node.=C2=A0=

So because of the above-described problem, if the= re is a bug at one place we need to fix it on both the places.=C2=A0=C2=A0<= /div>

Purpose:=C2=A0
  1. Remove dup= licate 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 '<= b>utils.py' for each child node.
  2. Move the common logic from= 'tables/utils.py' and '__init__.py' of the r= espective node to 'utils.py'.
  3. Both table and its res= pective child access the functions from the respective=C2=A0'utils.p= y'.

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

Please review/test=C2=A0the patch thoroughly for tables and= it's child nodes.

--
=
Thanks & Regards
<= b>Akshay Joshi
Sr. Software Architect
=
EnterpriseDB Software Indi= a Private Limited
Mobile: +91 976-788-8246
=
--000000000000eac14605974af761--