This directory contains a small Python helper upgrade_table_to_v6.py for checking a CrateDB table's
creation version and recreating it in the current CrateDB 6 format when needed.
CrateDB gradually dropping support for tables created with olded versions, so you must have all tables updated to the recent one. At the current version is v6.x and the support is dropped for v4.x. See [1] for more details.
The script only requires python3 and curl installed.
The script reads database connection settings from config.py:
DB_HOST = "host:4200"
DB_USERNAME = "user"
DB_PASSWORD = "password"upgrade_table_to_v6.py accepts a table name as either:
tableschema.table
If no schema is provided, the script assumes the doc schema.
It prints the table's version['created'] from information_schema.tables.
If the major version is below 6, it follows CrateDB's documented recreate,
copy, and swap workflow using a temporary table.
Preview the SQL without altering the table:
./upgrade_table_to_v6.py --dry-run my_schema.my_tableRun the upgrade:
./upgrade_table_to_v6.py my_schema.my_tableFor an unqualified table in the doc schema:
./upgrade_table_to_v6.py my_table- Use
--dry-runfirst to inspect the generated SQL. - The upgrade path creates a temporary table, copies data, swaps it into place, and drops the old table left behind by the swap.
- Copying large tables takes time. For example, updating a table with 100M records takes as long as 20 min on a decent computer.
[1] Table version compatibility and upgrade https://cratedb.com/docs/crate/reference/en/latest/admin/system-information.html#tables-need-to-be-upgraded