Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'ViewCommand' object has no attribute 'auto_commit' #7384

Closed
d3xter opened this issue Apr 16, 2024 · 2 comments
Closed

'ViewCommand' object has no attribute 'auto_commit' #7384

d3xter opened this issue Apr 16, 2024 · 2 comments
Assignees
Milestone

Comments

@d3xter
Copy link

d3xter commented Apr 16, 2024

Describe the bug

When changing the SELECT query of a View, no rows are displayed and "Total rows 0 of x" is shown at the bottom.

To Reproduce

Steps to reproduce the behavior:

  1. Create a simple View
  2. Right Click on the View -> View/Edit Data -> All Rows
  3. Change the query, e. g. add a "WHERE 1 = 1" at the end

Expected behavior

Rows are shown

Error message

2024-04-17 00:00:17,593: ERROR pgadmin: 'ViewCommand' object has no attribute 'auto_commit'
Traceback (most recent call last):
File "/usr/pgadmin4/venv/lib64/python3.12/site-packages/flask/app.py", line 1484, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/pgadmin4/venv/lib64/python3.12/site-packages/flask/app.py", line 1469, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/pgadmin4/venv/lib64/python3.12/site-packages/flask_login/utils.py", line 290, in decorated_view
return current_app.ensure_sync(func)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/pgadmin4/web/pgadmin/tools/sqleditor/init.py", line 887, in start_query_tool
return StartRunningQuery(blueprint, current_app.logger).execute(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/pgadmin4/web/pgadmin/tools/sqleditor/utils/start_running_query.py", line 93, in execute
self.__execute_query(
File "/usr/pgadmin4/web/pgadmin/tools/sqleditor/utils/start_running_query.py", line 140, in __execute_query
if StartRunningQuery.is_begin_required_for_sql_query(trans_obj,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/pgadmin4/web/pgadmin/tools/sqleditor/utils/start_running_query.py", line 177, in is_begin_required_for_sql_query
return (not trans_obj.auto_commit and
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'ViewCommand' object has no attribute 'auto_commit'

Screenshots

Original query:
grafik

After changing the query:
grafik

Desktop (please complete the following information):

  • OS: Fedora 39
  • Version: 8.5
  • Mode: Desktop
  • Package type: RPM
@d3xter d3xter added the Bug label Apr 16, 2024
@pravesh-sharma pravesh-sharma self-assigned this Apr 23, 2024
khushboovashi added a commit that referenced this issue Apr 23, 2024
…rror that the 'ViewCommand' object has no attribute 'auto_commit'. #7384
@akshay-joshi akshay-joshi added this to the 8.6 milestone Apr 24, 2024
@mtovmassian
Copy link

I got the same error while executing a request for creating a table from a select query. Example: create table foo as select * from bar; .
But this error appears only when the request is executed from a View/Edit Data tab converted to a Query Tool tab.
When executed directly in a Query Tool tab everything works as expected.

@anilsahoo20
Copy link
Contributor

Tested and verified on snapshot build: https://www.postgresql.org/ftp/pgadmin/pgadmin4/snapshots/2024-04-26/
Environment: macOs Ventura 13.5.1
Package: arm64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants