raphaelauv opened a new issue, #27910:
URL: https://github.com/apache/superset/issues/27910

   ### Bug description
   
   same than https://github.com/apache/superset/issues/25535
   
   if you run in the same context 
   
   superset db upgrade
   then
   superset init 
   
   it work
   
   but if you close the context between it fail
   
   ### How to reproduce the bug
   
   ```log
   
   ++ superset init
   logging was configured successfully
   2024-04-05 00:18:56,119:INFO:superset.utils.logging_configurator:logging was 
configured successfully
   2024-04-05 00:18:56,123:INFO:root:Configured event logger of type <class 
'superset.utils.log.DBEventLogger'>
   /usr/local/lib/python3.11/site-packages/flask_limiter/extension.py:337: 
UserWarning: Using the in-memory storage for tracking rate limits as no storage 
was explicitly specified. This is not recommended for production use. See: 
https://flask-limiter.readthedocs.io#configuring-a-storage-backend for 
documentation about configuring the storage backend.
     warnings.warn(
   No PIL installation found
   2024-04-05 00:18:56,234:INFO:superset.utils.screenshots:No PIL installation 
found
   Syncing role definition
   2024-04-05 00:18:58,530:INFO:superset.security.manager:Syncing role 
definition
   Syncing Admin perms
   2024-04-05 00:18:58,569:INFO:superset.security.manager:Syncing Admin perms
   Syncing Alpha perms
   2024-04-05 00:18:58,574:INFO:superset.security.manager:Syncing Alpha perms
   Syncing Gamma perms
   2024-04-05 00:18:58,629:INFO:superset.security.manager:Syncing Gamma perms
   Syncing sql_lab perms
   2024-04-05 00:18:58,680:INFO:superset.security.manager:Syncing sql_lab perms
   Fetching a set of all perms to lookup which ones are missing
   2024-04-05 00:18:58,732:INFO:superset.security.manager:Fetching a set of all 
perms to lookup which ones are missing
   Creating missing datasource permissions.
   2024-04-05 00:18:58,735:INFO:superset.security.manager:Creating missing 
datasource permissions.
   Traceback (most recent call last):
     File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 1910, in _execute_context
   Loaded your LOCAL configuration at [/opt/superset/superset_config.py]
       self.dialect.do_execute(
     File 
"/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 
736, in do_execute
       cursor.execute(statement, parameters)
   sqlite3.OperationalError: no such table: tables
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/usr/local/bin/superset", line 8, in <module>
       sys.exit(superset())
                ^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, 
in __call__
       return self.main(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, 
in main
       rv = self.invoke(ctx)
            ^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, 
in invoke
       return _process_result(sub_ctx.command.invoke(sub_ctx))
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, 
in invoke
       return ctx.invoke(self.callback, **ctx.params)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in 
invoke
       return __callback(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/click/decorators.py", line 
33, in new_func
       return f(get_current_context(), *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/flask/cli.py", line 358, in 
decorator
       return __ctx.invoke(f, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in 
invoke
       return __callback(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/click/decorators.py", line 
33, in new_func
       return f(get_current_context(), *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/flask/cli.py", line 358, in 
decorator
       return __ctx.invoke(f, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in 
invoke
       return __callback(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/superset/cli/main.py", line 
65, in init
       security_manager.sync_role_definitions()
     File 
"/usr/local/lib/python3.11/site-packages/superset/security/manager.py", line 
891, in sync_role_definitions
       self.create_missing_perms()
     File 
"/usr/local/lib/python3.11/site-packages/superset/security/manager.py", line 
837, in create_missing_perms
       datasources = SqlaTable.get_all_datasources(self.get_session)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/local/lib/python3.11/site-packages/superset/connectors/sqla/models.py", 
line 1960, in get_all_datasources
       return qry.all()
              ^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/query.py", 
line 2773, in all
       return self._iter().all()
              ^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/query.py", 
line 2916, in _iter
       result = self.session.execute(
                ^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/sqlalchemy/orm/session.py", 
line 1717, in execute
       result = conn._execute_20(statement, params or {}, execution_options)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 1710, in _execute_20
       return meth(self, args_10style, kwargs_10style, execution_options)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/sqlalchemy/sql/elements.py", 
line 334, in _execute_on_connection
       return connection._execute_clauseelement(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 1577, in _execute_clauseelement
       ret = self._execute_context(
             ^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 1953, in _execute_context
       self._handle_dbapi_exception(
     File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 2134, in _handle_dbapi_exception
       util.raise_(
     File "/usr/local/lib/python3.11/site-packages/sqlalchemy/util/compat.py", 
line 211, in raise_
       raise exception
     File "/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/base.py", 
line 1910, in _execute_context
       self.dialect.do_execute(
     File 
"/usr/local/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 
736, in do_execute
       cursor.execute(statement, parameters)
   sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: 
tables
   [SQL: SELECT tables.uuid AS tables_uuid, tables.created_on AS 
tables_created_on, tables.changed_on AS tables_changed_on, tables.id AS 
tables_id, tables.description AS tables_description, tables.default_endpoint AS 
tables_default_endpoint, tables.is_featured AS tables_is_featured, 
tables.filter_select_enabled AS tables_filter_select_enabled, tables."offset" 
AS tables_offset, tables.cache_timeout AS tables_cache_timeout, tables.params 
AS tables_params, tables.perm AS tables_perm, tables.schema_perm AS 
tables_schema_perm, tables.is_managed_externally AS 
tables_is_managed_externally, tables.external_url AS tables_external_url, 
tables.table_name AS tables_table_name, tables.main_dttm_col AS 
tables_main_dttm_col, tables.database_id AS tables_database_id, 
tables.fetch_values_predicate AS tables_fetch_values_predicate, tables.schema 
AS tables_schema, tables.sql AS tables_sql, tables.is_sqllab_view AS 
tables_is_sqllab_view, tables.template_params AS tables_template_params, 
tables.extra AS 
 tables_extra, tables.normalize_columns AS tables_normalize_columns, 
tables.always_filter_main_dttm AS tables_always_filter_main_dttm, 
tables.created_by_fk AS tables_created_by_fk, tables.changed_by_fk AS 
tables_changed_by_fk 
   FROM tables 
   WHERE tables.is_sqllab_view = 0]
   (Background on this error at: https://sqlalche.me/e/14/e3q8)
   
   ```
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   3.1.2
   
   ### Python version
   
   3.11
   
   ### Node version
   
   Not applicable
   
   ### Browser
   
   Not applicable
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [X] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [X] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [X] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to