07 · Tables A→ZD · Design the schema
Inspect the live schema
Read a table's current columns, types, keys, and constraints before changing anything.
Before any schema change, look at what's there. Two tools:
get_table_schema- columns, Arrow types, nullability.get_table_metadata- constraints, primary keys, partition columns, current version, description.
Inspect
eddytor describe table eddytor sales orders # schema, columns, constraintsget_table_schema(table="eddytor.cfg_xxx.<uuid>_orders")
get_table_metadata(table="eddytor.cfg_xxx.<uuid>_orders")The introspect-before-change habit
Good to know
Make this the first step of any modification:
1.
get_table_schema (types/nullability) → 2. get_table_metadata
(constraints/PKs/version) → 3. only then add a
column or
change settings.It tells you the current state (so you don't re-add an existing column), the current version (so you can confirm your change committed afterward), and which constraints might reject your change.