Re: RM 4463 - MSQL test cases for domain node

2019-08-23 Thread Dave Page
Hi

On Wed, Aug 21, 2019 at 8:58 AM Neel Patel 
wrote:

> Hi,
>
> Please find attached patch that will add more resql test cases and msql
> test cases for domain node.
>
>- Covered test cases for Length, Precision and Collation.
>- Also added msql test cases.
>
> While writing resql test cases for domain node, I found one more issue
> RM-4644 . I have sent
> separate patch for the same.
>

I'm getting the following error with this patch:

==
ERROR: runTest
(regression.re_sql.tests.test_resql.ReverseEngineeredSQLTestCases)
Reverse Engineered SQL Test Cases
--
Traceback (most recent call last):
  File
"/Users/dpage/git/pgadmin4/web/regression/re_sql/tests/test_resql.py", line
126, in runTest
self.execute_test_case(scenarios)
  File
"/Users/dpage/git/pgadmin4/web/regression/re_sql/tests/test_resql.py", line
204, in execute_test_case
if not self.check_msql(scenario, object_id):
  File
"/Users/dpage/git/pgadmin4/web/regression/re_sql/tests/test_resql.py", line
329, in check_msql
object_id)
  File
"/Users/dpage/git/pgadmin4/web/regression/re_sql/tests/test_resql.py", line
178, in get_url
object_url = url_for(rule.endpoint, **options)
  File
"/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/flask/helpers.py",
line 356, in url_for
return appctx.app.handle_url_build_error(error, endpoint, values)
  File
"/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/flask/app.py",
line 2061, in handle_url_build_error
reraise(exc_type, exc_value, tb)
  File
"/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/flask/_compat.py",
line 35, in reraise
raise value
  File
"/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/flask/helpers.py",
line 345, in url_for
force_external=external)
  File
"/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/werkzeug/routing.py",
line 1776, in build
raise BuildError(endpoint, values, method, self)
werkzeug.routing.BuildError: Could not build url for endpoint
'NODE-domain.msql_id' with values ['did', 'gid', 'scid', 'sid']. Did you
forget to specify values ['doid']?


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgAdmin 4 commit: Fix a debugger error when using Python 2.7. Fixes #44

2019-08-23 Thread Dave Page
Fix a debugger error when using Python 2.7. Fixes #4419

Also fixes a minor bug where a reload warning was unnecessarily given when 
closing the debugger.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=3dadb8989b64ecc9277356c3295953abffee0223
Author: Aditya Toshniwal 

Modified Files
--
docs/en_US/release_notes_4_13.rst | 1 +
web/pgadmin/tools/debugger/static/js/direct.js| 3 +--
web/pgadmin/tools/debugger/utils/debugger_instance.py | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)



Re: [GSoC][New Feature] Editable and Read-only Columns

2019-08-23 Thread Dave Page
On Fri, Aug 23, 2019 at 9:43 AM Yosry Muhammad  wrote:

> Hi Aditya,
>
> On Fri, Aug 23, 2019 at 7:33 AM Aditya Toshniwal <
> aditya.toshni...@enterprisedb.com> wrote:
>
>> Hi Yosry,
>>
>> The previously mentioned issues seems to be fixed. Below are few issues:
>> 1) On Python 2.7, I get below error when opening query tool:
>> 2019-08-23 10:49:09,329: ERROR flask.app: Object of type buffer is not
>> JSON serializable
>> Traceback (most recent call last):
>>   File
>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
>> line 1813, in full_dispatch_request
>> rv = self.dispatch_request()
>>   File
>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
>> line 1799, in dispatch_request
>> return self.view_functions[rule.endpoint](**req.view_args)
>>   File
>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask_login/utils.py",
>> line 261, in decorated_view
>> return func(*args, **kwargs)
>>   File
>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/__init__.py",
>> line 1544, in get_query_history
>> return QueryHistory.get(current_user.id, trans_obj.sid, conn.db)
>>   File
>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/utils/query_history.py",
>> line 21, in get
>> 'result': [rec.query_info for rec in result]
>>   File
>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/utils/ajax.py", line
>> 75, in make_json_response
>> separators=(',', ':'), encoding=encoding),
>>   File
>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/__init__.py",
>> line 399, in dumps
>> **kw).encode(obj)
>>   File
>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
>> line 296, in encode
>> chunks = self.iterencode(o, _one_shot=True)
>>   File
>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
>> line 378, in iterencode
>> return _iterencode(o, 0)
>>   File
>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/utils/ajax.py", line
>> 30, in default
>> return json.JSONEncoder.default(self, obj)
>>   File
>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
>> line 273, in default
>> o.__class__.__name__)
>> TypeError: Object of type buffer is not JSON serializable
>>
>
> This error exists on the master branch on Python 2.7, it is not caused by
> the patch. It is also not a regression of my previous Query History
> Enhancement patch, I checked.
>
>
>>
>> 2) The patch is not compatible with older pyscopg2 (2.7.7). I get below
>> error in View/Edit data.
>> [image: Screenshot 2019-08-23 at 10.53.30.png]
>> 2019-08-23 10:53:12,020: ERROR flask.app: 'table_column'
>> Traceback (most recent call last):
>>   File
>> "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask/app.py",
>> line 1813, in full_dispatch_request
>> rv = self.dispatch_request()
>>   File
>> "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask/app.py",
>> line 1799, in dispatch_request
>> return self.view_functions[rule.endpoint](**req.view_args)
>>   File
>> "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask_login/utils.py",
>> line 261, in decorated_view
>> return func(*args, **kwargs)
>>   File
>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/__init__.py",
>> line 435, in poll
>> columns = trans_obj.get_columns_types(conn)
>>   File
>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/command.py",
>> line 688, in get_columns_types
>> table_oid=table_oid)
>>   File
>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/utils/get_column_types.py",
>> line 38, in get_columns_types
>> if row['oid'] == col['table_column']:
>> KeyError: 'table_column'
>>
>
> I recall Dave mentioning that it is okay to use psycopg 2.8+ features and
> that it was a requirement of pgAdmin 4 now (clearly mentioned in
> requirements.txt too).
>

I did - then we had the whole table_oid issue on Debian/Ubuntu :-(


> However, I updated the patch for backwards compatibility. Please find an
> updated patch attached.
>
>
> --
> *Yosry Muhammad Yosry*
>
> Computer Engineering student,
> The Faculty of Engineering,
> Cairo University (2021).
> Class representative of CMP 2021.
> https://www.linkedin.com/in/yosrym93/
>


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: [pgAdmin][RM4419] Debugger does not work on python 2.7

2019-08-23 Thread Dave Page
Thanks, applied.

On Thu, Aug 22, 2019 at 9:15 AM Aditya Toshniwal <
aditya.toshni...@enterprisedb.com> wrote:

> Hi Hackers,
>
> Attached is the patch to fix an issue where debugger throws error and
> doesn't work when using Python 2.7.
> Also fixed a small issue where reload warning was thrown on closing
> debugger, which should applicable only if opened in new tab.
>
> Kindly review.
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB India | Pune
> "Don't Complain about Heat, Plant a TREE"
>


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: [GSoC][New Feature] Editable and Read-only Columns

2019-08-23 Thread Yosry Muhammad
 I updated the patch for backwards compatibility anyway.

On Fri, Aug 23, 2019 at 10:45 AM Dave Page  wrote:

>
>
> On Fri, Aug 23, 2019 at 9:43 AM Yosry Muhammad  wrote:
>
>> Hi Aditya,
>>
>> On Fri, Aug 23, 2019 at 7:33 AM Aditya Toshniwal <
>> aditya.toshni...@enterprisedb.com> wrote:
>>
>>> Hi Yosry,
>>>
>>> The previously mentioned issues seems to be fixed. Below are few issues:
>>> 1) On Python 2.7, I get below error when opening query tool:
>>> 2019-08-23 10:49:09,329: ERROR flask.app: Object of type buffer is not
>>> JSON serializable
>>> Traceback (most recent call last):
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
>>> line 1813, in full_dispatch_request
>>> rv = self.dispatch_request()
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
>>> line 1799, in dispatch_request
>>> return self.view_functions[rule.endpoint](**req.view_args)
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask_login/utils.py",
>>> line 261, in decorated_view
>>> return func(*args, **kwargs)
>>>   File
>>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/__init__.py",
>>> line 1544, in get_query_history
>>> return QueryHistory.get(current_user.id, trans_obj.sid, conn.db)
>>>   File
>>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/utils/query_history.py",
>>> line 21, in get
>>> 'result': [rec.query_info for rec in result]
>>>   File
>>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/utils/ajax.py", line
>>> 75, in make_json_response
>>> separators=(',', ':'), encoding=encoding),
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/__init__.py",
>>> line 399, in dumps
>>> **kw).encode(obj)
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
>>> line 296, in encode
>>> chunks = self.iterencode(o, _one_shot=True)
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
>>> line 378, in iterencode
>>> return _iterencode(o, 0)
>>>   File
>>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/utils/ajax.py", line
>>> 30, in default
>>> return json.JSONEncoder.default(self, obj)
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
>>> line 273, in default
>>> o.__class__.__name__)
>>> TypeError: Object of type buffer is not JSON serializable
>>>
>>
>> This error exists on the master branch on Python 2.7, it is not caused by
>> the patch. It is also not a regression of my previous Query History
>> Enhancement patch, I checked.
>>
>>
>>>
>>> 2) The patch is not compatible with older pyscopg2 (2.7.7). I get below
>>> error in View/Edit data.
>>> [image: Screenshot 2019-08-23 at 10.53.30.png]
>>> 2019-08-23 10:53:12,020: ERROR flask.app: 'table_column'
>>> Traceback (most recent call last):
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask/app.py",
>>> line 1813, in full_dispatch_request
>>> rv = self.dispatch_request()
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask/app.py",
>>> line 1799, in dispatch_request
>>> return self.view_functions[rule.endpoint](**req.view_args)
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask_login/utils.py",
>>> line 261, in decorated_view
>>> return func(*args, **kwargs)
>>>   File
>>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/__init__.py",
>>> line 435, in poll
>>> columns = trans_obj.get_columns_types(conn)
>>>   File
>>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/command.py",
>>> line 688, in get_columns_types
>>> table_oid=table_oid)
>>>   File
>>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/utils/get_column_types.py",
>>> line 38, in get_columns_types
>>> if row['oid'] == col['table_column']:
>>> KeyError: 'table_column'
>>>
>>
>> I recall Dave mentioning that it is okay to use psycopg 2.8+ features and
>> that it was a requirement of pgAdmin 4 now (clearly mentioned in
>> requirements.txt too).
>>
>
> I did - then we had the whole table_oid issue on Debian/Ubuntu :-(
>
>
>> However, I updated the patch for backwards compatibility. Please find an
>> updated patch attached.
>>
>>
>> --
>> *Yosry Muhammad Yosry*
>>
>> Computer Engineering student,
>> The Faculty of Engineering,
>> Cairo University (2021).
>> Class representative of CMP 2021.
>> https://www.linkedin.com/in/yosrym93/
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


-- 
*Yosry Muhammad Yosry*

Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class representative of CMP 2021.
ht

pgAdmin 4 commit: Fix PGADMIN_SERVER_JSON_FILE environment variable sup

2019-08-23 Thread Dave Page
Fix PGADMIN_SERVER_JSON_FILE environment variable support in the container. 
Fixes #4657

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=25f85fe123bc17bfa6141014a32fc55a3861e412

Modified Files
--
docs/en_US/release_notes_4_13.rst | 3 ++-
pkg/docker/entrypoint.sh  | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)



Re: Query Tool JS Minimal Refactoring

2019-08-23 Thread Yosry Muhammad
Please find an updated patch attached.

On Fri, Aug 23, 2019 at 7:57 AM Aditya Toshniwal <
aditya.toshni...@enterprisedb.com> wrote:

> Hi Yosry,
>
> This breaks the reconnect for query tool. Open a query tool, execute some
> query and then restart the python server. Go to the query tool and click
> execute. It will show a warning, on continuing it should connect again. It
> throws exception in browser console:
> Uncaught TypeError: Cannot read property 'apply' of undefined
> at Object.eval (VM69935 sqleditor.js:1769)
> at Object.callback (alertify.js:3347)
> at triggerCallback (alertify.js:1220)
> at Object.buttonsClickHandler (alertify.js:1241)
> at HTMLDivElement.eval (alertify.js:299)
>
> On Thu, Aug 22, 2019 at 11:44 PM Yosry Muhammad 
> wrote:
>
>> Please find an updated patch attached.
>>
>> On Mon, Aug 19, 2019 at 9:54 AM Yosry Muhammad 
>> wrote:
>>
>>> Jasmine tests passed on my machine, I will take another look once I have
>>> access to my machine.
>>>
>>> On Mon, Aug 19, 2019, 7:57 AM Akshay Joshi <
>>> akshay.jo...@enterprisedb.com> wrote:
>>>
 Hi Yosry

 Jasmine tests are failing, can you please fix those and resend the
 patch.

 On Fri, Aug 16, 2019 at 11:23 PM Yosry Muhammad 
 wrote:

> Hi hackers,
>
> Please find attached a patch with minimal refactoring of:
> web/pgadmin/tools/sqleditor/static/js/sqleditor.js
>
> This includes merging 2 redundant functions into one and renaming some
> functions to have more expressive and consistent names.
>
> Please review !
> 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/
>


 --
 *Thanks & Regards*
 *Akshay Joshi*

 *Sr. Software Architect*
 *EnterpriseDB Software India Private Limited*
 *Mobile: +91 976-788-8246*

>>>
>>
>> --
>> *Yosry Muhammad Yosry*
>>
>> Computer Engineering student,
>> The Faculty of Engineering,
>> Cairo University (2021).
>> Class representative of CMP 2021.
>> https://www.linkedin.com/in/yosrym93/
>>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB India | Pune
> "Don't Complain about Heat, Plant a TREE"
>


-- 
*Yosry Muhammad Yosry*

Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class representative of CMP 2021.
https://www.linkedin.com/in/yosrym93/
diff --git a/docs/en_US/release_notes_4_13.rst b/docs/en_US/release_notes_4_13.rst
index bc21dfeca..a0a3a38ef 100644
--- a/docs/en_US/release_notes_4_13.rst
+++ b/docs/en_US/release_notes_4_13.rst
@@ -22,5 +22,4 @@ Bug fixes
 | `Issue #2706 `_ -  Added ProjectSet icon for explain module.
 | `Issue #2828 `_ -  Added Gather Merge, Named Tuple Store Scan and Table Function Scan icon for explain module.
 | `Issue #4643 `_ -  Fix Truncate option deselect issue for compound triggers.
-| `Issue #4644 `_ -  Fix length and precision enable/disable issue when changing the data type for Domain node.
-| `Issue #4650 `_ -  Fix SQL tab issue for Views. It's a regression of compound triggers.
\ No newline at end of file
+| `Issue #4644 `_ -  Fix length and precision enable/disable issue when changing the data type for Domain node.
\ No newline at end of file
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
index 4bc357c83..cfefa5314 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
@@ -879,7 +879,6 @@ class ViewNode(PGChildNodeView, VacuumSettings):
 Get all compound trigger nodes associated with view node,
 generate their sql and render into sql tab
 """
-SQL_data = ''
 if self.manager.server_type == 'ppas' \
 and self.manager.version >= 12:
 
@@ -889,6 +888,7 @@ class ViewNode(PGChildNodeView, VacuumSettings):
 # Define template path
 self.ct_trigger_temp_path = 'compound_triggers'
 
+SQL_data = ''
 SQL = render_template("/".join(
 [self.ct_trigger_temp_path,
  'sql/{0}/#{1}#/nodes.sql'.format(
@@ -949,7 +949,7 @@ class ViewNode(PGChildNodeView, VacuumSettings):
 SQL_data += '\n'
 SQL_data += SQL
 
-return SQL_data
+return SQL_data
 
 def get_trigger_sql(self, vid):
 """
diff --git a/web/pgadmin/stat

Re: Query Tool JS Minimal Refactoring

2019-08-23 Thread Aditya Toshniwal
Hi Yosry,

The v3 patch has changes like:
diff --git a/docs/en_US/release_notes_4_13.rst
b/docs/en_US/release_notes_4_13.rst
index bc21dfeca..a0a3a38ef 100644
--- a/docs/en_US/release_notes_4_13.rst
+++ b/docs/en_US/release_notes_4_13.rst
@@ -22,5 +22,4 @@ Bug fixes
 | `Issue #2706 `_ -  Added
ProjectSet icon for explain module.
 | `Issue #2828 `_ -  Added
Gather Merge, Named Tuple Store Scan and Table Function Scan icon for
explain module.
 | `Issue #4643 `_ -  Fix
Truncate option deselect issue for compound triggers.
-| `Issue #4644 `_ -  Fix
length and precision enable/disable issue when changing the data type for
Domain node.
-| `Issue #4650 `_ -  Fix SQL
tab issue for Views. It's a regression of compound triggers.
\ No newline at end of file
+| `Issue #4644 `_ -  Fix
length and precision enable/disable issue when changing the data type for
Domain node.
\ No newline at end of file
diff --git
a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py

Looks like some other patch got mixed up.
Anyway, I've removed these changes and have attached the updated patch (v4)
ready for commit. Everything looks good to me.


On Fri, Aug 23, 2019 at 2:32 PM Yosry Muhammad  wrote:

> Please find an updated patch attached.
>
> On Fri, Aug 23, 2019 at 7:57 AM Aditya Toshniwal <
> aditya.toshni...@enterprisedb.com> wrote:
>
>> Hi Yosry,
>>
>> This breaks the reconnect for query tool. Open a query tool, execute some
>> query and then restart the python server. Go to the query tool and click
>> execute. It will show a warning, on continuing it should connect again. It
>> throws exception in browser console:
>> Uncaught TypeError: Cannot read property 'apply' of undefined
>> at Object.eval (VM69935 sqleditor.js:1769)
>> at Object.callback (alertify.js:3347)
>> at triggerCallback (alertify.js:1220)
>> at Object.buttonsClickHandler (alertify.js:1241)
>> at HTMLDivElement.eval (alertify.js:299)
>>
>> On Thu, Aug 22, 2019 at 11:44 PM Yosry Muhammad 
>> wrote:
>>
>>> Please find an updated patch attached.
>>>
>>> On Mon, Aug 19, 2019 at 9:54 AM Yosry Muhammad 
>>> wrote:
>>>
 Jasmine tests passed on my machine, I will take another look once I
 have access to my machine.

 On Mon, Aug 19, 2019, 7:57 AM Akshay Joshi <
 akshay.jo...@enterprisedb.com> wrote:

> Hi Yosry
>
> Jasmine tests are failing, can you please fix those and resend the
> patch.
>
> On Fri, Aug 16, 2019 at 11:23 PM Yosry Muhammad 
> wrote:
>
>> Hi hackers,
>>
>> Please find attached a patch with minimal refactoring of:
>> web/pgadmin/tools/sqleditor/static/js/sqleditor.js
>>
>> This includes merging 2 redundant functions into one and renaming
>> some functions to have more expressive and consistent names.
>>
>> Please review !
>> 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/
>>
>
>
> --
> *Thanks & Regards*
> *Akshay Joshi*
>
> *Sr. Software Architect*
> *EnterpriseDB Software India Private Limited*
> *Mobile: +91 976-788-8246*
>

>>>
>>> --
>>> *Yosry Muhammad Yosry*
>>>
>>> Computer Engineering student,
>>> The Faculty of Engineering,
>>> Cairo University (2021).
>>> Class representative of CMP 2021.
>>> https://www.linkedin.com/in/yosrym93/
>>>
>>
>>
>> --
>> Thanks and Regards,
>> Aditya Toshniwal
>> Software Engineer | EnterpriseDB India | Pune
>> "Don't Complain about Heat, Plant a TREE"
>>
>
>
> --
> *Yosry Muhammad Yosry*
>
> Computer Engineering student,
> The Faculty of Engineering,
> Cairo University (2021).
> Class representative of CMP 2021.
> https://www.linkedin.com/in/yosrym93/
>


-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"


sqleditorjs_refactor_v4.patch
Description: Binary data


Re: [GSoC][New Feature] Editable and Read-only Columns

2019-08-23 Thread Aditya Toshniwal
Excellent !! Looks good to me.

On Fri, Aug 23, 2019 at 2:23 PM Yosry Muhammad  wrote:

>  I updated the patch for backwards compatibility anyway.
>
> On Fri, Aug 23, 2019 at 10:45 AM Dave Page  wrote:
>
>>
>>
>> On Fri, Aug 23, 2019 at 9:43 AM Yosry Muhammad 
>> wrote:
>>
>>> Hi Aditya,
>>>
>>> On Fri, Aug 23, 2019 at 7:33 AM Aditya Toshniwal <
>>> aditya.toshni...@enterprisedb.com> wrote:
>>>
 Hi Yosry,

 The previously mentioned issues seems to be fixed. Below are few issues:
 1) On Python 2.7, I get below error when opening query tool:
 2019-08-23 10:49:09,329: ERROR flask.app: Object of type buffer is not
 JSON serializable
 Traceback (most recent call last):
   File
 "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
 line 1813, in full_dispatch_request
 rv = self.dispatch_request()
   File
 "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
 line 1799, in dispatch_request
 return self.view_functions[rule.endpoint](**req.view_args)
   File
 "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask_login/utils.py",
 line 261, in decorated_view
 return func(*args, **kwargs)
   File
 "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/__init__.py",
 line 1544, in get_query_history
 return QueryHistory.get(current_user.id, trans_obj.sid, conn.db)
   File
 "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/utils/query_history.py",
 line 21, in get
 'result': [rec.query_info for rec in result]
   File
 "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/utils/ajax.py", line
 75, in make_json_response
 separators=(',', ':'), encoding=encoding),
   File
 "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/__init__.py",
 line 399, in dumps
 **kw).encode(obj)
   File
 "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
 line 296, in encode
 chunks = self.iterencode(o, _one_shot=True)
   File
 "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
 line 378, in iterencode
 return _iterencode(o, 0)
   File
 "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/utils/ajax.py", line
 30, in default
 return json.JSONEncoder.default(self, obj)
   File
 "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
 line 273, in default
 o.__class__.__name__)
 TypeError: Object of type buffer is not JSON serializable

>>>
>>> This error exists on the master branch on Python 2.7, it is not caused
>>> by the patch. It is also not a regression of my previous Query History
>>> Enhancement patch, I checked.
>>>
>>>

 2) The patch is not compatible with older pyscopg2 (2.7.7). I get below
 error in View/Edit data.
 [image: Screenshot 2019-08-23 at 10.53.30.png]
 2019-08-23 10:53:12,020: ERROR flask.app: 'table_column'
 Traceback (most recent call last):
   File
 "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask/app.py",
 line 1813, in full_dispatch_request
 rv = self.dispatch_request()
   File
 "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask/app.py",
 line 1799, in dispatch_request
 return self.view_functions[rule.endpoint](**req.view_args)
   File
 "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask_login/utils.py",
 line 261, in decorated_view
 return func(*args, **kwargs)
   File
 "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/__init__.py",
 line 435, in poll
 columns = trans_obj.get_columns_types(conn)
   File
 "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/command.py",
 line 688, in get_columns_types
 table_oid=table_oid)
   File
 "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/utils/get_column_types.py",
 line 38, in get_columns_types
 if row['oid'] == col['table_column']:
 KeyError: 'table_column'

>>>
>>> I recall Dave mentioning that it is okay to use psycopg 2.8+ features
>>> and that it was a requirement of pgAdmin 4 now (clearly mentioned in
>>> requirements.txt too).
>>>
>>
>> I did - then we had the whole table_oid issue on Debian/Ubuntu :-(
>>
>>
>>> However, I updated the patch for backwards compatibility. Please find an
>>> updated patch attached.
>>>
>>>
>>> --
>>> *Yosry Muhammad Yosry*
>>>
>>> Computer Engineering student,
>>> The Faculty of Engineering,
>>> Cairo University (2021).
>>> Class representative of CMP 2021.
>>> https://www.linkedin.com/in/yosrym93/
>>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> Enter

pgAdmin 4 commit: Don't wait for the database connection before renderi

2019-08-23 Thread Dave Page
Don't wait for the database connection before rendering the Query Tool UI, for 
improved UX. Fixes #4453
In addition, unescape HTML entities in database names in the Query Tool title 
bar. Fixes #4584

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=234efc3be7cbe3ef787d2aafe372149f51e99c59
Author: Aditya Toshniwal 

Modified Files
--
docs/en_US/release_notes_4_13.rst  |   2 +
web/pgadmin/browser/utils.py   |  24 
web/pgadmin/static/js/sqleditor_utils.js   |  19 +--
web/pgadmin/static/js/utils.js |   6 +
web/pgadmin/tools/datagrid/__init__.py | 116 ++
web/pgadmin/tools/datagrid/static/js/datagrid.js   | 112 +-
.../datagrid/static/js/datagrid_panel_title.js |   2 +-
web/pgadmin/tools/datagrid/static/js/show_data.js  |  55 -
.../tools/datagrid/static/js/show_query_tool.js|  28 ++---
.../tools/datagrid/templates/datagrid/index.html   |  29 ++---
.../tools/sqleditor/static/css/sqleditor.css   |   4 +
web/pgadmin/tools/sqleditor/static/img/loading.gif | Bin 0 -> 1728 bytes
web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 131 ++---
.../tests/test_download_csv_query_tool.py  |  11 +-
.../tools/sqleditor/tests/test_editor_history.py   |   9 +-
.../tools/sqleditor/tests/test_encoding_charset.py |  10 +-
.../tools/sqleditor/tests/test_explain_plan.py |   9 +-
.../tools/sqleditor/tests/test_poll_query_tool.py  |   9 +-
.../sqleditor/tests/test_transaction_status.py |   8 +-
.../tools/sqleditor/tests/test_view_data.py|   9 +-
.../tests/test_is_query_resultset_updatable.py |   8 +-
.../utils/tests/test_save_changed_data.py  |   8 +-
.../javascript/datagrid/show_data_spec.js  |  64 +-
.../javascript/datagrid/show_query_tool_spec.js|  41 +++
web/regression/javascript/fake_endpoints.js|   1 +
web/regression/javascript/pgadmin_utils_spec.js|   9 +-
web/regression/javascript/sqleditor_utils_spec.js  |  56 -
web/yarn.lock  |   6 +-
28 files changed, 337 insertions(+), 449 deletions(-)



Re: [pgAdmin][RM4553] Query tool UX improvement

2019-08-23 Thread Dave Page
Nice! Patch applied, thanks.

On Thu, Aug 22, 2019 at 9:08 AM Aditya Toshniwal <
aditya.toshni...@enterprisedb.com> wrote:

> Forgot to mention, this patch also fixes
> https://redmine.postgresql.org/issues/4584 - HTML entities aren't escaped
> in database names
>
> On Thu, Aug 22, 2019 at 1:05 PM Aditya Toshniwal <
> aditya.toshni...@enterprisedb.com> wrote:
>
>> Hi Hackers,
>>
>> Attached is the patch to improve user experience when opening query tool.
>> Previously, when the query tool button was clicked, the request went to
>> backend, the connection was created and sent back to the UI. Until then,
>> there was no activity on the UI. For slow servers it looked like pgAdmin is
>> slow/struck.
>> With this change, the query tool will be opened instantaneously. Other
>> things like opening the connection is done in parallel with query tool
>> render, thus saving time.
>> The query tool connection status icon will show a spinner and text will
>> have "Obtaining connection..." until the connection is established.
>>
>> Test cases added/changed accordingly.
>>
>> Kindly review.
>> --
>> Thanks and Regards,
>> Aditya Toshniwal
>> Software Engineer | EnterpriseDB India | Pune
>> "Don't Complain about Heat, Plant a TREE"
>>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB India | Pune
> "Don't Complain about Heat, Plant a TREE"
>


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: Query Tool JS Minimal Refactoring

2019-08-23 Thread Dave Page
Hi

On Fri, Aug 23, 2019 at 11:28 AM Aditya Toshniwal <
aditya.toshni...@enterprisedb.com> wrote:

> Hi Yosry,
>
> The v3 patch has changes like:
> diff --git a/docs/en_US/release_notes_4_13.rst
> b/docs/en_US/release_notes_4_13.rst
> index bc21dfeca..a0a3a38ef 100644
> --- a/docs/en_US/release_notes_4_13.rst
> +++ b/docs/en_US/release_notes_4_13.rst
> @@ -22,5 +22,4 @@ Bug fixes
>  | `Issue #2706 `_ -  Added
> ProjectSet icon for explain module.
>  | `Issue #2828 `_ -  Added
> Gather Merge, Named Tuple Store Scan and Table Function Scan icon for
> explain module.
>  | `Issue #4643 `_ -  Fix
> Truncate option deselect issue for compound triggers.
> -| `Issue #4644 `_ -  Fix
> length and precision enable/disable issue when changing the data type for
> Domain node.
> -| `Issue #4650 `_ -  Fix SQL
> tab issue for Views. It's a regression of compound triggers.
> \ No newline at end of file
> +| `Issue #4644 `_ -  Fix
> length and precision enable/disable issue when changing the data type for
> Domain node.
> \ No newline at end of file
> diff --git
> a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
> b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
>
> Looks like some other patch got mixed up.
> Anyway, I've removed these changes and have attached the updated patch
> (v4) ready for commit. Everything looks good to me.
>

Like the editable columns patch, this one no longer applies.

Can we have a rebased version please?

Thanks!

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: [GSoC][New Feature] Editable and Read-only Columns

2019-08-23 Thread Dave Page
Except it now doesn't apply as the async connection/rendering patch was in
the queue right ahead of it :-(.

Can I get a rebased patch please?

On Fri, Aug 23, 2019 at 11:57 AM Aditya Toshniwal <
aditya.toshni...@enterprisedb.com> wrote:

> Excellent !! Looks good to me.
>
> On Fri, Aug 23, 2019 at 2:23 PM Yosry Muhammad  wrote:
>
>>  I updated the patch for backwards compatibility anyway.
>>
>> On Fri, Aug 23, 2019 at 10:45 AM Dave Page  wrote:
>>
>>>
>>>
>>> On Fri, Aug 23, 2019 at 9:43 AM Yosry Muhammad 
>>> wrote:
>>>
 Hi Aditya,

 On Fri, Aug 23, 2019 at 7:33 AM Aditya Toshniwal <
 aditya.toshni...@enterprisedb.com> wrote:

> Hi Yosry,
>
> The previously mentioned issues seems to be fixed. Below are few
> issues:
> 1) On Python 2.7, I get below error when opening query tool:
> 2019-08-23 10:49:09,329: ERROR flask.app: Object of type buffer is not
> JSON serializable
> Traceback (most recent call last):
>   File
> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
> line 1813, in full_dispatch_request
> rv = self.dispatch_request()
>   File
> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
> line 1799, in dispatch_request
> return self.view_functions[rule.endpoint](**req.view_args)
>   File
> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask_login/utils.py",
> line 261, in decorated_view
> return func(*args, **kwargs)
>   File
> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/__init__.py",
> line 1544, in get_query_history
> return QueryHistory.get(current_user.id, trans_obj.sid, conn.db)
>   File
> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/utils/query_history.py",
> line 21, in get
> 'result': [rec.query_info for rec in result]
>   File
> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/utils/ajax.py", line
> 75, in make_json_response
> separators=(',', ':'), encoding=encoding),
>   File
> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/__init__.py",
> line 399, in dumps
> **kw).encode(obj)
>   File
> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
> line 296, in encode
> chunks = self.iterencode(o, _one_shot=True)
>   File
> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
> line 378, in iterencode
> return _iterencode(o, 0)
>   File
> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/utils/ajax.py", line
> 30, in default
> return json.JSONEncoder.default(self, obj)
>   File
> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
> line 273, in default
> o.__class__.__name__)
> TypeError: Object of type buffer is not JSON serializable
>

 This error exists on the master branch on Python 2.7, it is not caused
 by the patch. It is also not a regression of my previous Query History
 Enhancement patch, I checked.


>
> 2) The patch is not compatible with older pyscopg2 (2.7.7). I get
> below error in View/Edit data.
> [image: Screenshot 2019-08-23 at 10.53.30.png]
> 2019-08-23 10:53:12,020: ERROR flask.app: 'table_column'
> Traceback (most recent call last):
>   File
> "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask/app.py",
> line 1813, in full_dispatch_request
> rv = self.dispatch_request()
>   File
> "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask/app.py",
> line 1799, in dispatch_request
> return self.view_functions[rule.endpoint](**req.view_args)
>   File
> "/Users/adityatoshniwal/venv/pypg35/lib/python3.5/site-packages/flask_login/utils.py",
> line 261, in decorated_view
> return func(*args, **kwargs)
>   File
> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/__init__.py",
> line 435, in poll
> columns = trans_obj.get_columns_types(conn)
>   File
> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/command.py",
> line 688, in get_columns_types
> table_oid=table_oid)
>   File
> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/utils/get_column_types.py",
> line 38, in get_columns_types
> if row['oid'] == col['table_column']:
> KeyError: 'table_column'
>

 I recall Dave mentioning that it is okay to use psycopg 2.8+ features
 and that it was a requirement of pgAdmin 4 now (clearly mentioned in
 requirements.txt too).

>>>
>>> I did - then we had the whole table_oid issue on Debian/Ubuntu :-(
>>>
>>>
 However, I updated the patch for backwards compatibili

Re: Query Tool JS Minimal Refactoring

2019-08-23 Thread Yosry Muhammad
Please find an updated patch attached.

On Fri, Aug 23, 2019 at 1:23 PM Dave Page  wrote:

> Hi
>
> On Fri, Aug 23, 2019 at 11:28 AM Aditya Toshniwal <
> aditya.toshni...@enterprisedb.com> wrote:
>
>> Hi Yosry,
>>
>> The v3 patch has changes like:
>> diff --git a/docs/en_US/release_notes_4_13.rst
>> b/docs/en_US/release_notes_4_13.rst
>> index bc21dfeca..a0a3a38ef 100644
>> --- a/docs/en_US/release_notes_4_13.rst
>> +++ b/docs/en_US/release_notes_4_13.rst
>> @@ -22,5 +22,4 @@ Bug fixes
>>  | `Issue #2706 `_ -  Added
>> ProjectSet icon for explain module.
>>  | `Issue #2828 `_ -  Added
>> Gather Merge, Named Tuple Store Scan and Table Function Scan icon for
>> explain module.
>>  | `Issue #4643 `_ -  Fix
>> Truncate option deselect issue for compound triggers.
>> -| `Issue #4644 `_ -  Fix
>> length and precision enable/disable issue when changing the data type for
>> Domain node.
>> -| `Issue #4650 `_ -  Fix
>> SQL tab issue for Views. It's a regression of compound triggers.
>> \ No newline at end of file
>> +| `Issue #4644 `_ -  Fix
>> length and precision enable/disable issue when changing the data type for
>> Domain node.
>> \ No newline at end of file
>> diff --git
>> a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
>> b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
>>
>> Looks like some other patch got mixed up.
>> Anyway, I've removed these changes and have attached the updated patch
>> (v4) ready for commit. Everything looks good to me.
>>
>
> Like the editable columns patch, this one no longer applies.
>
> Can we have a rebased version please?
>
> Thanks!
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


-- 
*Yosry Muhammad Yosry*

Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class representative of CMP 2021.
https://www.linkedin.com/in/yosrym93/
diff --git a/web/pgadmin/static/js/sqleditor/execute_query.js b/web/pgadmin/static/js/sqleditor/execute_query.js
index 26da69148..b8baa410d 100644
--- a/web/pgadmin/static/js/sqleditor/execute_query.js
+++ b/web/pgadmin/static/js/sqleditor/execute_query.js
@@ -224,22 +224,22 @@ class ExecuteQuery {
 }
 
 if (this.userManagement.isPgaLoginRequired(httpMessage.response)) {
-  this.sqlServerObject.saveState('execute', [this.explainPlan]);
+  this.sqlServerObject.saveState('check_data_changes_to_execute_query', [this.explainPlan]);
   this.userManagement.pgaLogin();
 }
 
 if (httpErrorHandler.httpResponseRequiresNewTransaction(httpMessage.response)) {
-  this.sqlServerObject.saveState('execute', [this.explainPlan]);
+  this.sqlServerObject.saveState('check_data_changes_to_execute_query', [this.explainPlan]);
   this.sqlServerObject.initTransaction();
 }
 
 if (this.wasDatabaseConnectionLost(httpMessage)) {
-  this.sqlServerObject.saveState('execute', [this.explainPlan]);
+  this.sqlServerObject.saveState('check_data_changes_to_execute_query', [this.explainPlan]);
   this.sqlServerObject.handle_connection_lost(false, httpMessage);
 }
 
 if(this.isCryptKeyMissing(httpMessage)) {
-  this.sqlServerObject.saveState('execute', [this.explainPlan]);
+  this.sqlServerObject.saveState('check_data_changes_to_execute_query', [this.explainPlan]);
   this.sqlServerObject.handle_cryptkey_missing();
   return;
 }
diff --git a/web/pgadmin/static/js/sqleditor/query_tool_actions.js b/web/pgadmin/static/js/sqleditor/query_tool_actions.js
index 18e15ecbe..34b6827ad 100644
--- a/web/pgadmin/static/js/sqleditor/query_tool_actions.js
+++ b/web/pgadmin/static/js/sqleditor/query_tool_actions.js
@@ -39,13 +39,8 @@ let queryToolActions = {
   },
 
   executeQuery: function (sqlEditorController) {
-if(sqlEditorController.is_query_tool) {
-  this._clearMessageTab();
-  sqlEditorController.execute();
-} else {
-  this._clearMessageTab();
-  sqlEditorController.execute_data_query();
-}
+this._clearMessageTab();
+sqlEditorController.check_data_changes_to_execute_query();
   },
 
   explainAnalyze: function (sqlEditorController) {
@@ -60,7 +55,7 @@ let queryToolActions = {
   settings: this._settings(),
 };
 this._clearMessageTab();
-sqlEditorController.execute(explainObject);
+sqlEditorController.check_data_changes_to_execute_query(explainObject);
   },
 
   explain: function (sqlEditorController) {
@@ -76,7 +71,7 @@ let queryToolActions = {
   settings: this._settings(),
 };
 this._clearMessageTab();
-sqlEditorController.execute(explainObject);
+sqlEditorControl

Re: Query Tool JS Minimal Refactoring

2019-08-23 Thread Dave Page
Thanks - I assume this is dependent on the updatable columns patch, as the
JS tests fail if I apply it to the current GIT head?

On Fri, Aug 23, 2019 at 1:07 PM Yosry Muhammad  wrote:

> Please find an updated patch attached.
>
> On Fri, Aug 23, 2019 at 1:23 PM Dave Page  wrote:
>
>> Hi
>>
>> On Fri, Aug 23, 2019 at 11:28 AM Aditya Toshniwal <
>> aditya.toshni...@enterprisedb.com> wrote:
>>
>>> Hi Yosry,
>>>
>>> The v3 patch has changes like:
>>> diff --git a/docs/en_US/release_notes_4_13.rst
>>> b/docs/en_US/release_notes_4_13.rst
>>> index bc21dfeca..a0a3a38ef 100644
>>> --- a/docs/en_US/release_notes_4_13.rst
>>> +++ b/docs/en_US/release_notes_4_13.rst
>>> @@ -22,5 +22,4 @@ Bug fixes
>>>  | `Issue #2706 `_ -  Added
>>> ProjectSet icon for explain module.
>>>  | `Issue #2828 `_ -  Added
>>> Gather Merge, Named Tuple Store Scan and Table Function Scan icon for
>>> explain module.
>>>  | `Issue #4643 `_ -  Fix
>>> Truncate option deselect issue for compound triggers.
>>> -| `Issue #4644 `_ -  Fix
>>> length and precision enable/disable issue when changing the data type for
>>> Domain node.
>>> -| `Issue #4650 `_ -  Fix
>>> SQL tab issue for Views. It's a regression of compound triggers.
>>> \ No newline at end of file
>>> +| `Issue #4644 `_ -  Fix
>>> length and precision enable/disable issue when changing the data type for
>>> Domain node.
>>> \ No newline at end of file
>>> diff --git
>>> a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
>>> b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
>>>
>>> Looks like some other patch got mixed up.
>>> Anyway, I've removed these changes and have attached the updated patch
>>> (v4) ready for commit. Everything looks good to me.
>>>
>>
>> Like the editable columns patch, this one no longer applies.
>>
>> Can we have a rebased version please?
>>
>> Thanks!
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
> --
> *Yosry Muhammad Yosry*
>
> Computer Engineering student,
> The Faculty of Engineering,
> Cairo University (2021).
> Class representative of CMP 2021.
> https://www.linkedin.com/in/yosrym93/
>


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: [GSoC][New Feature] Editable and Read-only Columns

2019-08-23 Thread Yosry Muhammad
Hi Dave,

The tests pass on my device normally. I am using Python 3.6 on Ubuntu. I
have ran all tests using "make check" and they all succeeded. I also ran
feature_tests/query_tool_journey_test.py multiple times on its own using
"cd web && python regression/runtests.py --pkg feature_tests --modules
query_tool_journey_test" and it passed successfully. Could you try again?

Generally, I have found that StaleElementReferenceException occurs
intermittently on various feature tests.

On Fri, Aug 23, 2019 at 3:46 PM Dave Page  wrote:

> Thanks. Unfortunately this is failing the tests:
>
> ==
> ERROR: runTest
> (pgadmin.feature_tests.query_tool_journey_test.QueryToolJourneyTest)
> Tests the path through the query tool
> --
> Traceback (most recent call last):
>   File
> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
> line 85, in runTest
> self._test_updatable_resultset()
>   File
> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
> line 254, in _test_updatable_resultset
> discard_changes_modal=True)
>   File
> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
> line 417, in _check_query_results_editable
> is_editable = self._check_cell_editable(column_index)
>   File
> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
> line 430, in _check_cell_editable
> cell_value = int(cell_el.text)
>   File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py",
> line 76, in text
> return self._execute(Command.GET_ELEMENT_TEXT)['value']
>   File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py",
> line 628, in _execute
> return self._parent.execute(command, params)
>   File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py",
> line 312, in execute
> self.error_handler.check_response(response)
>   File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py",
> line 242, in check_response
> raise exception_class(message, screen, stacktrace)
> selenium.common.exceptions.StaleElementReferenceException: Message: stale
> element reference: element is not attached to the page document
>   (Session info: chrome=76.0.3809.100)
>   (Driver info: chromedriver=76.0.3809.126
> (d80a294506b4c9d18015e755cee48f953ddc3f2f-refs/branch-heads/3809@{#1024}),platform=Mac
> OS X 10.14.5 x86_64)
>
> Without the patch, the tests pass.
>
>
> On Fri, Aug 23, 2019 at 1:10 PM Yosry Muhammad  wrote:
>
>> Please find an updated patch attached.
>>
>> On Fri, Aug 23, 2019 at 1:22 PM Dave Page  wrote:
>>
>>> Except it now doesn't apply as the async connection/rendering patch was
>>> in the queue right ahead of it :-(.
>>>
>>> Can I get a rebased patch please?
>>>
>>> On Fri, Aug 23, 2019 at 11:57 AM Aditya Toshniwal <
>>> aditya.toshni...@enterprisedb.com> wrote:
>>>
 Excellent !! Looks good to me.

 On Fri, Aug 23, 2019 at 2:23 PM Yosry Muhammad 
 wrote:

>  I updated the patch for backwards compatibility anyway.
>
> On Fri, Aug 23, 2019 at 10:45 AM Dave Page  wrote:
>
>>
>>
>> On Fri, Aug 23, 2019 at 9:43 AM Yosry Muhammad 
>> wrote:
>>
>>> Hi Aditya,
>>>
>>> On Fri, Aug 23, 2019 at 7:33 AM Aditya Toshniwal <
>>> aditya.toshni...@enterprisedb.com> wrote:
>>>
 Hi Yosry,

 The previously mentioned issues seems to be fixed. Below are few
 issues:
 1) On Python 2.7, I get below error when opening query tool:
 2019-08-23 10:49:09,329: ERROR flask.app: Object of type buffer is
 not JSON serializable
 Traceback (most recent call last):
   File
 "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
 line 1813, in full_dispatch_request
 rv = self.dispatch_request()
   File
 "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
 line 1799, in dispatch_request
 return self.view_functions[rule.endpoint](**req.view_args)
   File
 "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask_login/utils.py",
 line 261, in decorated_view
 return func(*args, **kwargs)
   File
 "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/__init__.py",
 line 1544, in get_query_history
 return QueryHistory.get(current_user.id, trans_obj.sid,
 conn.db)
   File
 "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/utils/query_history.py",
 line 21, in get
 'result'

Re: [GSoC][New Feature] Editable and Read-only Columns

2019-08-23 Thread Dave Page
Thanks. Unfortunately this is failing the tests:

==
ERROR: runTest
(pgadmin.feature_tests.query_tool_journey_test.QueryToolJourneyTest)
Tests the path through the query tool
--
Traceback (most recent call last):
  File
"/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
line 85, in runTest
self._test_updatable_resultset()
  File
"/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
line 254, in _test_updatable_resultset
discard_changes_modal=True)
  File
"/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
line 417, in _check_query_results_editable
is_editable = self._check_cell_editable(column_index)
  File
"/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
line 430, in _check_cell_editable
cell_value = int(cell_el.text)
  File
"/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py",
line 76, in text
return self._execute(Command.GET_ELEMENT_TEXT)['value']
  File
"/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py",
line 628, in _execute
return self._parent.execute(command, params)
  File
"/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py",
line 312, in execute
self.error_handler.check_response(response)
  File
"/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py",
line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.StaleElementReferenceException: Message: stale
element reference: element is not attached to the page document
  (Session info: chrome=76.0.3809.100)
  (Driver info: chromedriver=76.0.3809.126
(d80a294506b4c9d18015e755cee48f953ddc3f2f-refs/branch-heads/3809@{#1024}),platform=Mac
OS X 10.14.5 x86_64)

Without the patch, the tests pass.


On Fri, Aug 23, 2019 at 1:10 PM Yosry Muhammad  wrote:

> Please find an updated patch attached.
>
> On Fri, Aug 23, 2019 at 1:22 PM Dave Page  wrote:
>
>> Except it now doesn't apply as the async connection/rendering patch was
>> in the queue right ahead of it :-(.
>>
>> Can I get a rebased patch please?
>>
>> On Fri, Aug 23, 2019 at 11:57 AM Aditya Toshniwal <
>> aditya.toshni...@enterprisedb.com> wrote:
>>
>>> Excellent !! Looks good to me.
>>>
>>> On Fri, Aug 23, 2019 at 2:23 PM Yosry Muhammad 
>>> wrote:
>>>
  I updated the patch for backwards compatibility anyway.

 On Fri, Aug 23, 2019 at 10:45 AM Dave Page  wrote:

>
>
> On Fri, Aug 23, 2019 at 9:43 AM Yosry Muhammad 
> wrote:
>
>> Hi Aditya,
>>
>> On Fri, Aug 23, 2019 at 7:33 AM Aditya Toshniwal <
>> aditya.toshni...@enterprisedb.com> wrote:
>>
>>> Hi Yosry,
>>>
>>> The previously mentioned issues seems to be fixed. Below are few
>>> issues:
>>> 1) On Python 2.7, I get below error when opening query tool:
>>> 2019-08-23 10:49:09,329: ERROR flask.app: Object of type buffer is
>>> not JSON serializable
>>> Traceback (most recent call last):
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
>>> line 1813, in full_dispatch_request
>>> rv = self.dispatch_request()
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
>>> line 1799, in dispatch_request
>>> return self.view_functions[rule.endpoint](**req.view_args)
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask_login/utils.py",
>>> line 261, in decorated_view
>>> return func(*args, **kwargs)
>>>   File
>>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/__init__.py",
>>> line 1544, in get_query_history
>>> return QueryHistory.get(current_user.id, trans_obj.sid, conn.db)
>>>   File
>>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqleditor/utils/query_history.py",
>>> line 21, in get
>>> 'result': [rec.query_info for rec in result]
>>>   File
>>> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/utils/ajax.py", 
>>> line
>>> 75, in make_json_response
>>> separators=(',', ':'), encoding=encoding),
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/__init__.py",
>>> line 399, in dumps
>>> **kw).encode(obj)
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder.py",
>>> line 296, in encode
>>> chunks = self.iterencode(o, _one_shot=True)
>>>   File
>>> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/simplejson/encoder

Re: Query Tool JS Minimal Refactoring

2019-08-23 Thread Yosry Muhammad
No it isn't. I just needed to update JS tests after the latest modification
and merging with master. Please find an updated patch attached, sorry for
the inconvenience.

On Fri, Aug 23, 2019 at 3:47 PM Dave Page  wrote:

> Thanks - I assume this is dependent on the updatable columns patch, as the
> JS tests fail if I apply it to the current GIT head?
>
> On Fri, Aug 23, 2019 at 1:07 PM Yosry Muhammad  wrote:
>
>> Please find an updated patch attached.
>>
>> On Fri, Aug 23, 2019 at 1:23 PM Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Fri, Aug 23, 2019 at 11:28 AM Aditya Toshniwal <
>>> aditya.toshni...@enterprisedb.com> wrote:
>>>
 Hi Yosry,

 The v3 patch has changes like:
 diff --git a/docs/en_US/release_notes_4_13.rst
 b/docs/en_US/release_notes_4_13.rst
 index bc21dfeca..a0a3a38ef 100644
 --- a/docs/en_US/release_notes_4_13.rst
 +++ b/docs/en_US/release_notes_4_13.rst
 @@ -22,5 +22,4 @@ Bug fixes
  | `Issue #2706 `_ -
  Added ProjectSet icon for explain module.
  | `Issue #2828 `_ -
  Added Gather Merge, Named Tuple Store Scan and Table Function Scan icon
 for explain module.
  | `Issue #4643 `_ -  Fix
 Truncate option deselect issue for compound triggers.
 -| `Issue #4644 `_ -  Fix
 length and precision enable/disable issue when changing the data type for
 Domain node.
 -| `Issue #4650 `_ -  Fix
 SQL tab issue for Views. It's a regression of compound triggers.
 \ No newline at end of file
 +| `Issue #4644 `_ -  Fix
 length and precision enable/disable issue when changing the data type for
 Domain node.
 \ No newline at end of file
 diff --git
 a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
 b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py

 Looks like some other patch got mixed up.
 Anyway, I've removed these changes and have attached the updated patch
 (v4) ready for commit. Everything looks good to me.

>>>
>>> Like the editable columns patch, this one no longer applies.
>>>
>>> Can we have a rebased version please?
>>>
>>> Thanks!
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>> --
>> *Yosry Muhammad Yosry*
>>
>> Computer Engineering student,
>> The Faculty of Engineering,
>> Cairo University (2021).
>> Class representative of CMP 2021.
>> https://www.linkedin.com/in/yosrym93/
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


-- 
*Yosry Muhammad Yosry*

Computer Engineering student,
The Faculty of Engineering,
Cairo University (2021).
Class representative of CMP 2021.
https://www.linkedin.com/in/yosrym93/
diff --git a/web/pgadmin/static/js/sqleditor/execute_query.js b/web/pgadmin/static/js/sqleditor/execute_query.js
index 26da69148..b8baa410d 100644
--- a/web/pgadmin/static/js/sqleditor/execute_query.js
+++ b/web/pgadmin/static/js/sqleditor/execute_query.js
@@ -224,22 +224,22 @@ class ExecuteQuery {
 }
 
 if (this.userManagement.isPgaLoginRequired(httpMessage.response)) {
-  this.sqlServerObject.saveState('execute', [this.explainPlan]);
+  this.sqlServerObject.saveState('check_data_changes_to_execute_query', [this.explainPlan]);
   this.userManagement.pgaLogin();
 }
 
 if (httpErrorHandler.httpResponseRequiresNewTransaction(httpMessage.response)) {
-  this.sqlServerObject.saveState('execute', [this.explainPlan]);
+  this.sqlServerObject.saveState('check_data_changes_to_execute_query', [this.explainPlan]);
   this.sqlServerObject.initTransaction();
 }
 
 if (this.wasDatabaseConnectionLost(httpMessage)) {
-  this.sqlServerObject.saveState('execute', [this.explainPlan]);
+  this.sqlServerObject.saveState('check_data_changes_to_execute_query', [this.explainPlan]);
   this.sqlServerObject.handle_connection_lost(false, httpMessage);
 }
 
 if(this.isCryptKeyMissing(httpMessage)) {
-  this.sqlServerObject.saveState('execute', [this.explainPlan]);
+  this.sqlServerObject.saveState('check_data_changes_to_execute_query', [this.explainPlan]);
   this.sqlServerObject.handle_cryptkey_missing();
   return;
 }
diff --git a/web/pgadmin/static/js/sqleditor/query_tool_actions.js b/web/pgadmin/static/js/sqleditor/query_tool_actions.js
index 18e15ecbe..34b6827ad 100644
--- a/web/pgadmin/static/js/sqleditor/query_tool_actions.js
+++ b/web/pgadmin/static/js/sqleditor/query_tool_actions.js
@@ -39,13 +39,8 @@ let queryToolActions = {

pgAdmin 4 commit: Some refactoring of sqleditor.js.

2019-08-23 Thread Dave Page
Some refactoring of sqleditor.js.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=5887fb38153e94307dfc8be47085353b9b9acf81
Author: Yosry Muhammad 

Modified Files
--
web/pgadmin/static/js/sqleditor/execute_query.js   |   8 +-
.../static/js/sqleditor/query_tool_actions.js  |  13 +--
web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 107 +
.../javascript/sqleditor/execute_query_spec.js |   6 +-
.../sqleditor/query_tool_actions_spec.js   |  25 +++--
5 files changed, 66 insertions(+), 93 deletions(-)



Re: [GSoC][New Feature] Editable and Read-only Columns

2019-08-23 Thread Dave Page
Hi

I've run it again 4 more times and it fails consistently for me. I'm
running on macOS 10.14.5 with Chrome 76.0.3809.100.

On Fri, Aug 23, 2019 at 3:17 PM Yosry Muhammad  wrote:

> Hi Dave,
>
> The tests pass on my device normally. I am using Python 3.6 on Ubuntu. I
> have ran all tests using "make check" and they all succeeded. I also ran
> feature_tests/query_tool_journey_test.py multiple times on its own using
> "cd web && python regression/runtests.py --pkg feature_tests --modules
> query_tool_journey_test" and it passed successfully. Could you try again?
>
> Generally, I have found that StaleElementReferenceException occurs
> intermittently on various feature tests.
>
> On Fri, Aug 23, 2019 at 3:46 PM Dave Page  wrote:
>
>> Thanks. Unfortunately this is failing the tests:
>>
>> ==
>> ERROR: runTest
>> (pgadmin.feature_tests.query_tool_journey_test.QueryToolJourneyTest)
>> Tests the path through the query tool
>> --
>> Traceback (most recent call last):
>>   File
>> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
>> line 85, in runTest
>> self._test_updatable_resultset()
>>   File
>> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
>> line 254, in _test_updatable_resultset
>> discard_changes_modal=True)
>>   File
>> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
>> line 417, in _check_query_results_editable
>> is_editable = self._check_cell_editable(column_index)
>>   File
>> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
>> line 430, in _check_cell_editable
>> cell_value = int(cell_el.text)
>>   File
>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py",
>> line 76, in text
>> return self._execute(Command.GET_ELEMENT_TEXT)['value']
>>   File
>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py",
>> line 628, in _execute
>> return self._parent.execute(command, params)
>>   File
>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py",
>> line 312, in execute
>> self.error_handler.check_response(response)
>>   File
>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py",
>> line 242, in check_response
>> raise exception_class(message, screen, stacktrace)
>> selenium.common.exceptions.StaleElementReferenceException: Message: stale
>> element reference: element is not attached to the page document
>>   (Session info: chrome=76.0.3809.100)
>>   (Driver info: chromedriver=76.0.3809.126
>> (d80a294506b4c9d18015e755cee48f953ddc3f2f-refs/branch-heads/3809@{#1024}),platform=Mac
>> OS X 10.14.5 x86_64)
>>
>> Without the patch, the tests pass.
>>
>>
>> On Fri, Aug 23, 2019 at 1:10 PM Yosry Muhammad 
>> wrote:
>>
>>> Please find an updated patch attached.
>>>
>>> On Fri, Aug 23, 2019 at 1:22 PM Dave Page  wrote:
>>>
 Except it now doesn't apply as the async connection/rendering patch was
 in the queue right ahead of it :-(.

 Can I get a rebased patch please?

 On Fri, Aug 23, 2019 at 11:57 AM Aditya Toshniwal <
 aditya.toshni...@enterprisedb.com> wrote:

> Excellent !! Looks good to me.
>
> On Fri, Aug 23, 2019 at 2:23 PM Yosry Muhammad 
> wrote:
>
>>  I updated the patch for backwards compatibility anyway.
>>
>> On Fri, Aug 23, 2019 at 10:45 AM Dave Page  wrote:
>>
>>>
>>>
>>> On Fri, Aug 23, 2019 at 9:43 AM Yosry Muhammad 
>>> wrote:
>>>
 Hi Aditya,

 On Fri, Aug 23, 2019 at 7:33 AM Aditya Toshniwal <
 aditya.toshni...@enterprisedb.com> wrote:

> Hi Yosry,
>
> The previously mentioned issues seems to be fixed. Below are few
> issues:
> 1) On Python 2.7, I get below error when opening query tool:
> 2019-08-23 10:49:09,329: ERROR flask.app: Object of type buffer is
> not JSON serializable
> Traceback (most recent call last):
>   File
> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
> line 1813, in full_dispatch_request
> rv = self.dispatch_request()
>   File
> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask/app.py",
> line 1799, in dispatch_request
> return self.view_functions[rule.endpoint](**req.view_args)
>   File
> "/Users/adityatoshniwal/venv/pypg27/lib/python2.7/site-packages/flask_login/utils.py",
> line 261, in decorated_view
> return func(*args, **kwargs)
>   File
> "/Users/adityatoshniwal/projects/pgadmin4/web/pgadmin/tools/sqledi

Re: Query Tool JS Minimal Refactoring

2019-08-23 Thread Dave Page
Thanks, committed.

On Fri, Aug 23, 2019 at 3:42 PM Yosry Muhammad  wrote:

> No it isn't. I just needed to update JS tests after the latest
> modification and merging with master. Please find an updated patch
> attached, sorry for the inconvenience.
>
> On Fri, Aug 23, 2019 at 3:47 PM Dave Page  wrote:
>
>> Thanks - I assume this is dependent on the updatable columns patch, as
>> the JS tests fail if I apply it to the current GIT head?
>>
>> On Fri, Aug 23, 2019 at 1:07 PM Yosry Muhammad 
>> wrote:
>>
>>> Please find an updated patch attached.
>>>
>>> On Fri, Aug 23, 2019 at 1:23 PM Dave Page  wrote:
>>>
 Hi

 On Fri, Aug 23, 2019 at 11:28 AM Aditya Toshniwal <
 aditya.toshni...@enterprisedb.com> wrote:

> Hi Yosry,
>
> The v3 patch has changes like:
> diff --git a/docs/en_US/release_notes_4_13.rst
> b/docs/en_US/release_notes_4_13.rst
> index bc21dfeca..a0a3a38ef 100644
> --- a/docs/en_US/release_notes_4_13.rst
> +++ b/docs/en_US/release_notes_4_13.rst
> @@ -22,5 +22,4 @@ Bug fixes
>  | `Issue #2706 `_ -
>  Added ProjectSet icon for explain module.
>  | `Issue #2828 `_ -
>  Added Gather Merge, Named Tuple Store Scan and Table Function Scan icon
> for explain module.
>  | `Issue #4643 `_ -  Fix
> Truncate option deselect issue for compound triggers.
> -| `Issue #4644 `_ -  Fix
> length and precision enable/disable issue when changing the data type for
> Domain node.
> -| `Issue #4650 `_ -  Fix
> SQL tab issue for Views. It's a regression of compound triggers.
> \ No newline at end of file
> +| `Issue #4644 `_ -  Fix
> length and precision enable/disable issue when changing the data type for
> Domain node.
> \ No newline at end of file
> diff --git
> a/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
> b/web/pgadmin/browser/server_groups/servers/databases/schemas/views/__init__.py
>
> Looks like some other patch got mixed up.
> Anyway, I've removed these changes and have attached the updated patch
> (v4) ready for commit. Everything looks good to me.
>

 Like the editable columns patch, this one no longer applies.

 Can we have a rebased version please?

 Thanks!

 --
 Dave Page
 Blog: http://pgsnake.blogspot.com
 Twitter: @pgsnake

 EnterpriseDB UK: http://www.enterprisedb.com
 The Enterprise PostgreSQL Company

>>>
>>>
>>> --
>>> *Yosry Muhammad Yosry*
>>>
>>> Computer Engineering student,
>>> The Faculty of Engineering,
>>> Cairo University (2021).
>>> Class representative of CMP 2021.
>>> https://www.linkedin.com/in/yosrym93/
>>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
> --
> *Yosry Muhammad Yosry*
>
> Computer Engineering student,
> The Faculty of Engineering,
> Cairo University (2021).
> Class representative of CMP 2021.
> https://www.linkedin.com/in/yosrym93/
>


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: [GSoC][New Feature] Editable and Read-only Columns

2019-08-23 Thread Yosry Muhammad
Hi Aditya,

Thanks a lot.

Do you have any idea why this problem never occurred on my machine by the
way?

On Sat, Aug 24, 2019, 8:18 AM Aditya Toshniwal <
aditya.toshni...@enterprisedb.com> wrote:

> Hi Yosry,
>
> It's failing for me as well. I debugged and found that, sometimes the grid
> render is delayed (in microseconds) after query execution. Because of
> which, the cell you had selected using xpath is actually the older one. And
> when you're trying to set the value the cell no longer exists as the new
> cell is rendered now. That's why stale element exception. Adding below code
> solved the problem for me. Attached is the patch.
>
> import time
> time.sleep(0.5)
> for column_index, should_be_editable in enumerated_should_be_editable:
>
>
> On Sat, Aug 24, 2019 at 4:08 AM Yosry Muhammad  wrote:
>
>> Hi Dave,
>>
>> I am now using the same versions of Python, Chrome and chromedriver. The
>> tests still pass every time. Are you sure you applied the latest patch? I
>> re-created the patch as a sanity check, please find it attached.
>>
>> I tried running the specific test a lot of times, passes every time. The
>> only difference is that I am running Ubuntu, otherwise, everything is the
>> same.
>>
>>
>> On Fri, Aug 23, 2019 at 5:00 PM Dave Page  wrote:
>>
>>> Hi
>>>
>>> I've run it again 4 more times and it fails consistently for me. I'm
>>> running on macOS 10.14.5 with Chrome 76.0.3809.100.
>>>
>>> On Fri, Aug 23, 2019 at 3:17 PM Yosry Muhammad 
>>> wrote:
>>>
 Hi Dave,

 The tests pass on my device normally. I am using Python 3.6 on Ubuntu.
 I have ran all tests using "make check" and they all succeeded. I also ran
 feature_tests/query_tool_journey_test.py multiple times on its own using
 "cd web && python regression/runtests.py --pkg feature_tests --modules
 query_tool_journey_test" and it passed successfully. Could you try again?

 Generally, I have found that StaleElementReferenceException occurs
 intermittently on various feature tests.

 On Fri, Aug 23, 2019 at 3:46 PM Dave Page  wrote:

> Thanks. Unfortunately this is failing the tests:
>
> ==
> ERROR: runTest
> (pgadmin.feature_tests.query_tool_journey_test.QueryToolJourneyTest)
> Tests the path through the query tool
> --
> Traceback (most recent call last):
>   File
> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
> line 85, in runTest
> self._test_updatable_resultset()
>   File
> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
> line 254, in _test_updatable_resultset
> discard_changes_modal=True)
>   File
> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
> line 417, in _check_query_results_editable
> is_editable = self._check_cell_editable(column_index)
>   File
> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
> line 430, in _check_cell_editable
> cell_value = int(cell_el.text)
>   File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py",
> line 76, in text
> return self._execute(Command.GET_ELEMENT_TEXT)['value']
>   File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py",
> line 628, in _execute
> return self._parent.execute(command, params)
>   File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py",
> line 312, in execute
> self.error_handler.check_response(response)
>   File
> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py",
> line 242, in check_response
> raise exception_class(message, screen, stacktrace)
> selenium.common.exceptions.StaleElementReferenceException: Message:
> stale element reference: element is not attached to the page document
>   (Session info: chrome=76.0.3809.100)
>   (Driver info: chromedriver=76.0.3809.126
> (d80a294506b4c9d18015e755cee48f953ddc3f2f-refs/branch-heads/3809@{#1024}),platform=Mac
> OS X 10.14.5 x86_64)
>
> Without the patch, the tests pass.
>
>
> On Fri, Aug 23, 2019 at 1:10 PM Yosry Muhammad 
> wrote:
>
>> Please find an updated patch attached.
>>
>> On Fri, Aug 23, 2019 at 1:22 PM Dave Page  wrote:
>>
>>> Except it now doesn't apply as the async connection/rendering patch
>>> was in the queue right ahead of it :-(.
>>>
>>> Can I get a rebased patch please?
>>>
>>> On Fri, Aug 23, 2019 at 11:57 AM Aditya Toshniwal <
>>> aditya.toshni...@enterprisedb.com> wrote:
>>>
>>

Re: [GSoC][New Feature] Editable and Read-only Columns

2019-08-23 Thread Yosry Muhammad
Makes sense. Thanks a lot for your help :)

On Sat, Aug 24, 2019, 8:40 AM Aditya Toshniwal <
aditya.toshni...@enterprisedb.com> wrote:

> Hi Yosry,
>
> My guess is because selenium is running faster on our machine. Depends on
> machine.
>
> On Sat, Aug 24, 2019, 12:06 Yosry Muhammad  wrote:
>
>> Hi Aditya,
>>
>> Thanks a lot.
>>
>> Do you have any idea why this problem never occurred on my machine by the
>> way?
>>
>> On Sat, Aug 24, 2019, 8:18 AM Aditya Toshniwal <
>> aditya.toshni...@enterprisedb.com> wrote:
>>
>>> Hi Yosry,
>>>
>>> It's failing for me as well. I debugged and found that, sometimes the
>>> grid render is delayed (in microseconds) after query execution. Because of
>>> which, the cell you had selected using xpath is actually the older one. And
>>> when you're trying to set the value the cell no longer exists as the new
>>> cell is rendered now. That's why stale element exception. Adding below code
>>> solved the problem for me. Attached is the patch.
>>>
>>> import time
>>> time.sleep(0.5)
>>> for column_index, should_be_editable in enumerated_should_be_editable:
>>>
>>>
>>> On Sat, Aug 24, 2019 at 4:08 AM Yosry Muhammad 
>>> wrote:
>>>
 Hi Dave,

 I am now using the same versions of Python, Chrome and chromedriver.
 The tests still pass every time. Are you sure you applied the latest patch?
 I re-created the patch as a sanity check, please find it attached.

 I tried running the specific test a lot of times, passes every time.
 The only difference is that I am running Ubuntu, otherwise, everything is
 the same.


 On Fri, Aug 23, 2019 at 5:00 PM Dave Page  wrote:

> Hi
>
> I've run it again 4 more times and it fails consistently for me. I'm
> running on macOS 10.14.5 with Chrome 76.0.3809.100.
>
> On Fri, Aug 23, 2019 at 3:17 PM Yosry Muhammad 
> wrote:
>
>> Hi Dave,
>>
>> The tests pass on my device normally. I am using Python 3.6 on
>> Ubuntu. I have ran all tests using "make check" and they all succeeded. I
>> also ran feature_tests/query_tool_journey_test.py multiple times on its 
>> own
>> using "cd web && python regression/runtests.py --pkg feature_tests
>> --modules query_tool_journey_test" and it passed successfully. Could you
>> try again?
>>
>> Generally, I have found that StaleElementReferenceException occurs
>> intermittently on various feature tests.
>>
>> On Fri, Aug 23, 2019 at 3:46 PM Dave Page  wrote:
>>
>>> Thanks. Unfortunately this is failing the tests:
>>>
>>>
>>> ==
>>> ERROR: runTest
>>> (pgadmin.feature_tests.query_tool_journey_test.QueryToolJourneyTest)
>>> Tests the path through the query tool
>>>
>>> --
>>> Traceback (most recent call last):
>>>   File
>>> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
>>> line 85, in runTest
>>> self._test_updatable_resultset()
>>>   File
>>> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
>>> line 254, in _test_updatable_resultset
>>> discard_changes_modal=True)
>>>   File
>>> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
>>> line 417, in _check_query_results_editable
>>> is_editable = self._check_cell_editable(column_index)
>>>   File
>>> "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_journey_test.py",
>>> line 430, in _check_cell_editable
>>> cell_value = int(cell_el.text)
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py",
>>> line 76, in text
>>> return self._execute(Command.GET_ELEMENT_TEXT)['value']
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py",
>>> line 628, in _execute
>>> return self._parent.execute(command, params)
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py",
>>> line 312, in execute
>>> self.error_handler.check_response(response)
>>>   File
>>> "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py",
>>> line 242, in check_response
>>> raise exception_class(message, screen, stacktrace)
>>> selenium.common.exceptions.StaleElementReferenceException: Message:
>>> stale element reference: element is not attached to the page document
>>>   (Session info: chrome=76.0.3809.100)
>>>   (Driver info: chromedriver=76.0.3809.126
>>> (d80a294506b4c9d18015e755cee48f953ddc3f2f-refs/branch-heads/3809@{#1024}),platform=Mac
>>> OS X 10.14.5 x86_64)
>>>