Can I download my Database Schema map

I’ve just imported my external SQL tables into Anvil. Can I download a full database Schema map? With all the tables and table fields and fieldtypes, plus your equivalent of which keys act as foreign (linked) keys.

Yes. It’s undocumented, and subject to change without notice, but I’ve found two ways to get this information.

  1. Back up your App as a downloadable file. This file is in .yaml format, and can be read using any yaml library. The schema is filed in two ways: one under key db_schema and one under key exported_table_schema. Each is formatted a bit differently, but they’re not too hard to decipher.
  2. If you’re using Git to maintain a local copy of your source code, you’ll find it under key db_schema in anvil.yaml.

When I say “subject to change without notice”, that’s actually happened, recently. So if you build automation on top of your schema, you’ll want to keep an eye on it, and adapt to changes as they occur.

1 Like