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

Error runnning db upgrade on 2.1.0 "sqlalchemy.exc.StatementError: (builtins.AttributeError) 'function' object has no attribute 'replace'" #254

Open
gonzalo opened this issue Apr 24, 2023 · 0 comments

Comments

@gonzalo
Copy link
Contributor

gonzalo commented Apr 24, 2023

I'm not completly sure to report this as a bug but I think is interesting and probably necesary if you're upgrading from older versions.

If you tray to run an upgrade directly from 1.3.2 or even 1.5.1 to 2.1.0 you'll receive an error when running db upgrade. The essential part of error is this one.

INFO  [alembic.runtime.migration] Running upgrade ad07e4fdbaba -> a9422eeaae74, new_dataset_models_take_2
>> Copy 4 physical tables to sl_tables...
>> Copy 54 SqlaTable to sl_datasets...
   Copy dataset owners...
   Link physical datasets with tables...
>> Copy 818 table columns to sl_columns...
   Link all columns to sl_datasets...
>> Copy 84 metrics to sl_columns...
   Link metric columns to datasets...
>> Run postprocessing on 902 columns
   [Column 1 to 902] 848 may be updated
   Assign table column relations...
>> Run postprocessing on 54 datasets
   Process dataset 1~54...                              
>> Assign new UUIDs to tables...

Adding uuids for `sl_tables`...
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-
....
  File "/usr/local/lib/python3.8/uuid.py", line 168, in __init__
    hex = hex.replace('urn:', '').replace('uuid:', '')
AttributeError: 'function' object has no attribute 'replace'
....
  File "/usr/local/lib/python3.8/uuid.py", line 168, in __init__
    hex = hex.replace('urn:', '').replace('uuid:', '')
sqlalchemy.exc.StatementError: (builtins.AttributeError) 'function' object has no attribute 'replace'
[SQL: UPDATE sl_tables SET uuid=?, changed_on=? WHERE sl_tables.id = ?]
[parameters: [{'uuid': <function uuid4 at 0x7f89fc9cde50>, 'sl_tables_id': 1}, {'uuid': <function uuid4 at 0x7f89fc9cde50>, 'sl_tables_id': 2}, {'uuid': <function uuid4 at 0x7f89fc9cde50>, 'sl_tables_id': 3}, {'uuid': <function uuid4 at 0x7f89fc9cde50>, 'sl_tables_id': 4}]]

It seems related to some changes on python version. apache/superset#22418

One posible walkthrough is moving first to 2.0.0, run db upgrades and then move to 2.1.0

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