# Exporting schema (model structure) to sql

**URL:** <https://forum.djangoproject.com/t/exporting-schema-model-structure-to-sql/34362>\
**Category:** Using Django\
**Created:** [August 31, 2024, 1:03pm UTC](https://forum.djangoproject.com/t/exporting-schema-model-structure-to-sql/34362 "2024-08-31T13:03:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chokosabe](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/chokosabe/32/23627_2.png) [@chokosabe](https://forum.djangoproject.com/u/chokosabe)\
**Post date:** [August 31, 2024, 1:03pm UTC](https://forum.djangoproject.com/t/exporting-schema-model-structure-to-sql/34362/1 "2024-08-31T13:03:30Z")

</div>

We are developing a django app. The database is shared with an application written in rust. We want to be able to use the schema in the rust tests.

Is there a clean way to export the database or the individual sql used to create each table as sql files? Aware of sqlmigrate - a bit befuddled as to why it works the way it does (no all option).

Thanks in advance

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [August 31, 2024, 2:55pm UTC](https://forum.djangoproject.com/t/exporting-schema-model-structure-to-sql/34362/2 "2024-08-31T14:55:58Z")

</div>

Your best option for this would be to use your database’s tools to do it. (e.g. `pg_dump` if you’re using PostgreSQL.)
