Forums

backing up database (which uses alembic)

Hi,

I'd like to back up my database, so I tried the following:

mysqldump -u schematica -h schematica.mysql.pythonanywhere-services.com --set-gtid-purged=OFF --no-tablespaces 'schematica$default' > db-backup.sql

It returned this error:

mysqldump: Couldn't execute 'SELECT COLUMN_NAME, JSON_EXTRACT(HISTOGRAM, '$."number-of-buckets-specified"') FROM information_schema.COLUMN_STATISTICS WHERE SCHEMA_NAME = 'schematica$default' AND TABLE_NAME = 'alembic_version';': Unknown table 'COLUMN_STATISTICS' in information_schema (1109)

My app uses flask sqlalchemy to manage coordination between my data model and the database. I suspect this is what is causing the error.

Can you please let me know what command I should use to perform a database backup?

It sounds like you are running this with the MySQL 8 command-line tools, so you should add --column-statistics=0 to that command (the second example on the help page).

Thanks! that worked.

Great, glad to hear it!