vvaezian / metabase_api_python

A python wrapper for Metabase API
MIT License
136 stars 40 forks source link

KeyError: 'sizeX' #41

Closed ccalby closed 1 year ago

ccalby commented 1 year ago

When running the mb.copy_collection command,

Copying the dashboard "Report" ... Traceback (most recent call last): File "/root/./copy_metabase_reports.py", line 5, in mb.copy_collection(source_collection_id=5, destination_parent_collection_id=11, deepcopy_dashboards=True, verbose=True) File "/usr/local/lib/python3.10/dist-packages/metabase_api/metabase_api.py", line 931, in copy_collection self.copy_dashboard(source_dashboard_id=dashboard_id, File "/usr/local/lib/python3.10/dist-packages/metabase_api/metabase_api.py", line 838, in copy_dashboard card_json[prop] = card[prop] KeyError: 'sizeX' root@localhost:~#

{ "browser-info": { "language": "en-GB", "platform": "Win32", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", "vendor": "Google Inc." }, "system-info": { "file.encoding": "UTF-8", "java.runtime.name": "OpenJDK Runtime Environment", "java.runtime.version": "11.0.17+8", "java.vendor": "Eclipse Adoptium", "java.vendor.url": "https://adoptium.net/", "java.version": "11.0.17", "java.vm.name": "OpenJDK 64-Bit Server VM", "java.vm.version": "11.0.17+8", "os.name": "Linux", "os.version": "5.15.0-56-generic", "user.language": "en", "user.timezone": "GMT" }, "metabase-info": { "databases": [ "h2", "mysql" ], "hosting-env": "unknown", "application-database": "mysql", "application-database-details": { "database": { "name": "MySQL", "version": "8.0.31-0ubuntu0.22.04.1" }, "jdbc-driver": { "name": "MariaDB Connector/J", "version": "2.7.6" } }, "run-mode": "prod", "version": { "date": "2022-12-07", "tag": "v0.45.1", "branch": "release-x.45.x", "hash": "019d31c" }, "settings": { "report-timezone": null } } }

vvaezian commented 1 year ago

Hi @ccalby. This error is due to a change introduced in v.45 of Metabase. I'll fix this for the Python wrapper once the version v.45.2 of Metabase is released (as it fixes quite a few issues). In the meantime, to fix the error on your end, you can replace sizeX and sizeY in the source code with size_x and size_y.

noahtf13 commented 1 year ago

Is this fixed? I'm still getting the issue. Thanks for the hard work @vvaezian

vvaezian commented 1 year ago

Fixed in version 0.2.16.

noahtf13 commented 1 year ago

Amazing, thank you!