leweex95 opened a new issue, #32316:
URL: https://github.com/apache/airflow/issues/32316

   ### Apache Airflow version
   
   2.6.2
   
   ### What happened
   
   I installed `apache-airflow` and attempted to set up the db via: 
   
   `airflow db init`
   
   but it fails with the following pydantic error:
   
   ```
   DB: sqlite:////Users/username/airflow/airflow.db
   
/Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/pydantic/_internal/_config.py:257
 UserWarning: Valid config keys have changed in V2:
   * 'orm_mode' has been renamed to 'from_attributes'
   Traceback (most recent call last):
     File "Users/username/Desktop/project_root/.venv/bin/airflow", line 8, in 
<module>
       sys.exit(main())
     File 
"Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/__main__.py",
 line 48, in main
       args.func(args)
     File 
"Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/cli/cli_config.py",
 line 52, in command
       return func(*args, **kwargs)
     File 
"Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/cli/commands/db_command.py",
 line 37, in initdb
       db.initdb()
     File 
"Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/utils/session.py",
 line 76, in wrapper
       return func(*args, session=session, **kwargs)
     File 
"Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/utils/db.py",
 line 711, in initdb
       import_all_models()
     File 
"Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/models/__init__.py",
 line 60, in import_all_models
       __getattr__(name)
     File 
"Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/models/__init__.py",
 line 78, in __getattr__
       val = import_string(f"{path}.{name}")
     File 
"/Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/utils/module_loading.py",
 line 36, in import_string
       module = import_module(module_path)
     File 
"/opt/homebrew/Cellar/[email protected]/3.9.17/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py",
 line 127, in import_module
       return _bootstrap._gcd_import(name[level:], package, level)
     File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
     File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
     File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
     File "<frozen importlib._bootstrap_external>", line 850, in exec_module
     File "<frozen importlib._bootstrap>", line 228, in 
_call_with_frames_removed
     File 
"/Users/levente_csibi/Desktop/Continental_HW/.venv/lib/python3.9/site-packages/airflow/models/skipmixin.py",
 line 25, in <module>
       from airflow.serialization.pydantic.dag_run import DagRunPydantic
     File 
"/Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/serialization/pydantic/dag_run.py",
 line 24, in <module>
       from airflow.serialization.pydantic.dataset import DatasetEventPydantic
     File 
"/Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/airflow/serialization/pydantic/dataset.py",
 line 40, in <module>
       class TaskOutletDatasetReferencePydantic(BaseModelPydantic):
     File 
"/Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py",
 line 95, in __new__
       private_attributes = inspect_namespace(
     File 
"/Users/username/Desktop/project_root/.venv/lib/python3.9/site-packages/pydantic/_internal/_model_construction.py",
 line 328, in inspect_namespace
       raise PydanticUserError(
   pydantic.errors.PydanticUserError: A non-annotated attribute was detected: 
`dag_id = <class 'str'>`. All model fields require a type annotation; if 
`dag_id` is not meant to be a field, you may be able to resolve this error by 
annotating it as a `ClassVar` or updating `model_config['ignored_types']`.
   ```
   
   ### What you think should happen instead
   
   _No response_
   
   ### How to reproduce
   
   1. install `apache-airflow` via pip 
   2. open terminal, cd to `~/airflow` folder
   3. run `airflow db init` command
   
   ### Operating System
   
   MacOS Ventura 13.3.1.
   
   ### Versions of Apache Airflow Providers
   
   **apache-airflow-providers-common-sql==1.5.2
   apache-airflow-providers-ftp==3.4.2
   apache-airflow-providers-http==4.4.2
   apache-airflow-providers-imap==3.2.2
   apache-airflow-providers-sqlite==3.4.2**
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to