You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "codecakes (via GitHub)" <gi...@apache.org> on 2023/07/23 16:33:01 UTC

[GitHub] [airflow] codecakes commented on issue #32783: sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file

codecakes commented on issue #32783:
URL: https://github.com/apache/airflow/issues/32783#issuecomment-1646884016

   In the following excerpts taken from the link, whether absolute path is necessary isn't explicitly mentioned [here](https://airflow.apache.org/docs/apache-airflow/stable/start.html)
   
   > Set Airflow Home (optional):
   
   
   > Airflow requires a home directory, and uses ~/airflow by default, but you can set a different location if you prefer. The AIRFLOW_HOME environment variable is used to inform Airflow of the desired location. This step of setting the environment variable should be done before installing Airflow so that the installation process knows where to store the necessary files.
   
   
   While setting the `$AIRFLOW_HOME` value absolute path, it throws the error:
   
   ```bash
   
   standalone | Starting Airflow Standalone
   standalone | Checking database is initialized
   Traceback (most recent call last):
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3371, in _wrap_pool_connect
       return fn()
              ^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 327, in connect
       return _ConnectionFairy._checkout(self)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 894, in _checkout
       fairy = _ConnectionRecord.checkout(pool)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 493, in checkout
       rec = pool._do_get()
             ^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 256, in _do_get
       return self._create_connection()
              ^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 273, in _create_connection
       return _ConnectionRecord(self)
              ^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 388, in __init__
       self.__connect()
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 690, in __connect
       with util.safe_reraise():
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
       compat.raise_(
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
       raise exception
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 686, in __connect
       self.dbapi_connection = connection = pool._invoke_creator(self)
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/create.py", line 574, in connect
       return dialect.connect(*cargs, **cparams)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 598, in connect
       return self.dbapi.connect(*cargs, **cparams)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   sqlite3.OperationalError: unable to open database file
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/bin/airflow", line 8, in <module>
       sys.exit(main())
                ^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/airflow/__main__.py", line 48, in main
       args.func(args)
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/airflow/cli/cli_config.py", line 52, in command
       return func(*args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/airflow/cli/commands/standalone_command.py", line 50, in entrypoint
       StandaloneCommand().run()
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/airflow/cli/commands/standalone_command.py", line 66, in run
       self.initialize_database()
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/airflow/cli/commands/standalone_command.py", line 176, in initialize_database
       db.initdb()
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/airflow/utils/session.py", line 76, in wrapper
       return func(*args, session=session, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/airflow/utils/db.py", line 718, in initdb
       _create_db_from_orm(session=session)
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/airflow/utils/db.py", line 703, in _create_db_from_orm
       _create_flask_session_tbl(engine.url)
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/airflow/utils/db.py", line 697, in _create_flask_session_tbl
       db.create_all()
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/flask_sqlalchemy/__init__.py", line 1094, in create_all
       self._execute_for_all_tables(app, bind, 'create_all')
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/flask_sqlalchemy/__init__.py", line 1086, in _execute_for_all_tables
       op(bind=self.get_engine(app, bind), **extra)
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/sql/schema.py", line 4930, in create_all
       bind._run_ddl_visitor(
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3237, in _run_ddl_visitor
       with self.begin() as conn:
            ^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3153, in begin
       conn = self.connect(close_with_result=close_with_result)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3325, in connect
       return self._connection_cls(self, close_with_result=close_with_result)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 96, in __init__
       else engine.raw_connection()
            ^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3404, in raw_connection
       return self._wrap_pool_connect(self.pool.connect, _connection)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3374, in _wrap_pool_connect
       Connection._handle_dbapi_exception_noconnection(
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 2208, in _handle_dbapi_exception_noconnection
       util.raise_(
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
       raise exception
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/base.py", line 3371, in _wrap_pool_connect
       return fn()
              ^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 327, in connect
       return _ConnectionFairy._checkout(self)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 894, in _checkout
       fairy = _ConnectionRecord.checkout(pool)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 493, in checkout
       rec = pool._do_get()
             ^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/impl.py", line 256, in _do_get
       return self._create_connection()
              ^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 273, in _create_connection
       return _ConnectionRecord(self)
              ^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 388, in __init__
       self.__connect()
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 690, in __connect
       with util.safe_reraise():
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
       compat.raise_(
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
       raise exception
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/pool/base.py", line 686, in __connect
       self.dbapi_connection = connection = pool._invoke_creator(self)
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/create.py", line 574, in connect
       return dialect.connect(*cargs, **cparams)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/Users/akul/Library/Caches/pypoetry/virtualenvs/ingest-facility-processor-7CA4xpJk-py3.11/lib/python3.11/site-packages/sqlalchemy/engine/default.py", line 598, in connect
       return self.dbapi.connect(*cargs, **cparams)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
   (Background on this error at: https://sqlalche.me/e/14/e3q8)
   
   ```
   
   
   > For the future - please follow what you are told when you opened the issue and open discussion instead. 
   
   Where am I told? This is mentioned neither while [opening the issue ](https://github.com/apache/airflow/issues/new/choose) nor in the [description in Triage process](https://github.com/apache/airflow/blob/main/ISSUE_TRIAGE_PROCESS.rst)


-- 
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: commits-unsubscribe@airflow.apache.org

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