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

Recent Installation of cubetl raises error with SQLAlchemy #18

Open
pdsparks opened this issue Apr 9, 2021 · 1 comment
Open

Recent Installation of cubetl raises error with SQLAlchemy #18

pdsparks opened this issue Apr 9, 2021 · 1 comment

Comments

@pdsparks
Copy link

pdsparks commented Apr 9, 2021

Reporting Error and Fix

When following the installation procedures provided here (Raspberry Pi OS) we throw an error at

cubestl -h

ERROR LAST LINE OF TRACEBACK
File "/home/<user>/cubetl/cubetl/sql/sql.py", line 33, in <module>
from sqlalchemy.types import Integer, String, Float, Boolean, Unicode, Date, Time, DateTime, Binary ImportError: cannot import name 'Binary' from 'sqlalchemy.types' (/home/<user>/cubetl/env/lib/python3.7/site-packages/sqlalchemy/types.py)

FIX
Edit cubetl/sql/sql.py and alter import names to match case in sqlalchemy types.py

from sqlalchemy.types import Integer, String, Float, Boolean, Unicode, Date, Time, DateTime, Binary

to

from sqlalchemy.types import INTEGER, String, FLOAT, BOOLEAN, Unicode, DATE, Time, DATETIME, BINARY

I hope this fix helps anyone else who encounters the error and lets them get to using this brilliant tool.

Phil

@pdsparks
Copy link
Author

pdsparks commented Apr 9, 2021

Also need to update at lines 132 - 152 of sql.py

if (column.type == "Integer"):
            return INTEGER
        elif (column.type == "String"):
            #if (column.length is None): column.length = 128
            return Unicode(length = 128)
        elif (column.type == "Float"):
            return FLOAT
        elif (column.type == "Boolean"):
            return BOOLEAN
        elif (column.type == "AutoIncrement"):
            return INTEGER
        elif (column.type == "Date"):
            return DATE
        elif (column.type == "Time"):
            return Time
        elif (column.type == "DateTime"):
            return DATETIME
        elif (column.type == "Binary"):
            return BINARY
        else:
            raise Exception("Invalid data type (%s): %s" % (column, column.type))

Apologies for missing this bit out in original comment.

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

No branches or pull requests

1 participant