AttributeError: module 'sqlalchemy.dialects.postgresql' has no attribute 'MONEY' with python3.7.3 and marshmallow-sqlalchemy==0.23.1
xu-xiang opened this issue · 5 comments
xu-xiang commented
sqlalchemy==1.3.19
marshmallow-sqlalchemy==0.23.1
➜ ~ python3 --version
Python 3.7.3
mac os
➜ ~ sudo pip3 install marshmallow-sqlalchemy==0.23.1
WARNING: The directory '/Users/jax/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting marshmallow-sqlalchemy==0.23.1
Downloading marshmallow_sqlalchemy-0.23.1-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: marshmallow>=2.15.2 in /Library/Python/3.7/site-packages (from marshmallow-sqlalchemy==0.23.1) (2.21.0)
Requirement already satisfied: SQLAlchemy>=1.2.0 in /Library/Python/3.7/site-packages (from marshmallow-sqlalchemy==0.23.1) (1.3.19)
Installing collected packages: marshmallow-sqlalchemy
Attempting uninstall: marshmallow-sqlalchemy
Found existing installation: marshmallow-sqlalchemy 0.23.0
Uninstalling marshmallow-sqlalchemy-0.23.0:
Successfully uninstalled marshmallow-sqlalchemy-0.23.0
Successfully installed marshmallow-sqlalchemy-0.23.1
➜ ~ python3 --version
Python 3.7.3
➜ ~ sudo pip3 install sqlalchemy
Password:
WARNING: The directory '/Users/jax/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: sqlalchemy in /Library/Python/3.7/site-packages (1.3.19)
➜ ~
/usr/local/bin/python3.7 /Users/jax/xx/github/airflow/airflow/__main__.py db init
DB: postgresql://postgres:***@******/airflow_mac
[2020-08-22 19:50:09,673] {db.py:619} INFO - Creating tables
INFO [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO [alembic.runtime.migration] Will assume transactional DDL.
Traceback (most recent call last):
File "/Users/jax/xx/github/airflow/airflow/__main__.py", line 44, in <module>
main()
File "/Users/jax/xx/github/airflow/airflow/__main__.py", line 40, in main
args.func(args)
File "/Users/jax/xx/github/airflow/airflow/cli/cli_parser.py", line 53, in command
return func(*args, **kwargs)
File "/Users/jax/xx/github/airflow/airflow/cli/commands/db_command.py", line 31, in initdb
db.initdb()
File "/Users/jax/xx/github/airflow/airflow/utils/db.py", line 569, in initdb
from flask_appbuilder.models.sqla import Base
File "/usr/local/lib/python3.7/site-packages/Flask_AppBuilder-3.0.1-py3.7.egg/flask_appbuilder/__init__.py", line 5, in <module>
from .api import ModelRestApi # noqa: F401
File "/usr/local/lib/python3.7/site-packages/Flask_AppBuilder-3.0.1-py3.7.egg/flask_appbuilder/api/__init__.py", line 15, in <module>
from marshmallow_sqlalchemy.fields import Related, RelatedList
File "/Library/Python/3.7/site-packages/marshmallow_sqlalchemy/__init__.py", line 1, in <module>
from .schema import (
File "/Library/Python/3.7/site-packages/marshmallow_sqlalchemy/schema/__init__.py", line 1, in <module>
from .model_schema import ModelSchema, ModelSchemaOpts, ModelSchemaMeta
File "/Library/Python/3.7/site-packages/marshmallow_sqlalchemy/schema/model_schema.py", line 5, in <module>
from ..convert import ModelConverter
File "/Library/Python/3.7/site-packages/marshmallow_sqlalchemy/convert.py", line 38, in <module>
class ModelConverter:
File "/Library/Python/3.7/site-packages/marshmallow_sqlalchemy/convert.py", line 56, in ModelConverter
postgresql.MONEY: fields.Decimal,
AttributeError: module 'sqlalchemy.dialects.postgresql' has no attribute 'MONEY'
Process finished with exit code 1
sloria commented
I'm not able to reproduce this. Can you run
pip freeze | grep -i sqlalchemy
so that we can double check the version of sqlalchemy you're using?
xu-xiang commented
➜ ~ pip freeze | grep -i sqlalchemy
Flask-SQLAlchemy==2.4.3
marshmallow-sqlalchemy==0.23.1
snowflake-sqlalchemy==1.2.3
SQLAlchemy==1.3.19
SQLAlchemy-JSONField==0.9.0
SQLAlchemy-Utils==0.36.6
tks
xu-xiang commented
Linux is ok but mac os has error.
sloria commented
I'm still unable to reproduce this. It doesn't appear to be an issue with marshmallow-sqlalchemy. More likely it is in issue with the virtualenv on your mac. Maybe try recreating it?
xu-xiang commented
I have try recreated virtualenv and run this code . I'm also unable to reproduce this. It seems to be working - -