# Export/import database

**URL:** https://community.baserow.io/t/export-import-database/1272
**Category:** Technical Help
**Tags:** docker
**Created:** [August 30, 2022, 10:52am UTC](https://community.baserow.io/t/export-import-database/1272 "2022-08-30T10:52:21Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![come](https://community.baserow.io/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@come](https://community.baserow.io/u/come)
#### Post date: [August 30, 2022, 10:52am UTC](https://community.baserow.io/t/export-import-database/1272/1 "2022-08-30T10:52:21Z")

</div>

Hi,  
I have installed baserow in my pre-production cluster and create some tables in a database.  
I’m using docker images baserow:1.10

I now install basrow in my production environment and want to migrate database from preproduction to production

I tried to export each tables and import them in the production baserow but table field are lost (type , fk …)

I tried to copy data from /baserow/date but the container failed to start

How to migrate database from one cluster to another ?

---

<div class="post-metadata">

### Author: ![petrs](https://community.baserow.io/user_avatar/community.baserow.io/petrs/32/159_2.png) [@petrs](https://community.baserow.io/u/petrs)
#### Post date: [August 30, 2022, 3:24pm UTC](https://community.baserow.io/t/export-import-database/1272/2 "2022-08-30T15:24:34Z")

</div>

Hi @come, since you are self-hosting, you can leverage internal Baserow commands to import & export applications (databases) of a workspace.

So let’s say that your original workspace has `id=60`, then you could export as:

```auto
django-admin export_workspace_applications 60

```

And import on the new instance as:

```auto
django-admin import_workspace_applications 70 workspace_60

```

The `workspace_60` is the name of the export, this would be the default name. `70` would be a workspace id of the new workspace on the new instance. You would need to transfer this file from the old to the new Baserow instance.

These commands are DJango commands, hence why they are called through `django-admin` (or `manage.py` file).

These commands can be run from backend containers in the `docker-compose` setup, not sure from top of my head if this will work out of the box in the single Docker image.

---

<div class="post-metadata">

### Author: ![nigel](https://community.baserow.io/user_avatar/community.baserow.io/nigel/32/51_2.png) [@nigel](https://community.baserow.io/u/nigel)
#### Post date: [August 30, 2022, 5:36pm UTC](https://community.baserow.io/t/export-import-database/1272/3 "2022-08-30T17:36:07Z")

</div>

See [Install with Docker // Baserow](https://baserow.io/docs/installation%2Finstall-with-docker#backup-all-of-baserow) for a guide on how to do this with the `baserow/baserow:XYZ` docker image (the single one Petrs refers to above in his solution).

---

<div class="post-metadata">

### Author: ![come](https://community.baserow.io/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@come](https://community.baserow.io/u/come)
#### Post date: [August 31, 2022, 9:03am UTC](https://community.baserow.io/t/export-import-database/1272/4 "2022-08-31T09:03:30Z")

</div>

Thanks for your reponses

How can I find the id of my workspace ?

I tried to run the command but I have this exception with root:

Traceback (most recent call last):  
File “/baserow/backend/src/baserow/manage.py”, line 40, in   
main()  
File “/baserow/backend/src/baserow/manage.py”, line 36, in main  
execute\_from\_command\_line(sys.argv)  
File “/baserow/venv/lib/python3.7/site-packages/django/core/management/ **init**.py”, line 419, in execute\_from\_command\_line  
utility.execute()  
File “/baserow/venv/lib/python3.7/site-packages/django/core/management/ **init**.py”, line 413, in execute  
self.fetch\_command(subcommand).run\_from\_argv(self.argv)  
File “/baserow/venv/lib/python3.7/site-packages/django/core/management/base.py”, line 354, in run\_from\_argv  
self.execute(\*args, \*\*cmd\_options)  
File “/baserow/venv/lib/python3.7/site-packages/django/core/management/base.py”, line 398, in execute  
output = self.handle(\*args, \*\*options)  
File “/baserow/backend/src/baserow/core/management/commands/export\_workspace\_applications.py”, line 55, in handle  
with open(files\_path, “wb”) as files\_buffer:  
PermissionError: [Errno 13] Permission denied: ‘/group\_11.zip’

---

<div class="post-metadata">

### Author: ![come](https://community.baserow.io/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@come](https://community.baserow.io/u/come)
#### Post date: [September 13, 2022, 2:38pm UTC](https://community.baserow.io/t/export-import-database/1272/5 "2022-09-13T14:38:31Z")

</div>

May I have a response ?

---

<div class="post-metadata">

### Author: ![nigel](https://community.baserow.io/user_avatar/community.baserow.io/nigel/32/51_2.png) [@nigel](https://community.baserow.io/u/nigel)
#### Post date: [September 13, 2022, 5:17pm UTC](https://community.baserow.io/t/export-import-database/1272/6 "2022-09-13T17:17:51Z")

</div>

Can you provide the exact details of the exact command you ran and how you ran it? From the looks of your error whatever command you are running cannot write out to that location. Even if running as root on your host OS, file permissions and users are different inside docker containers: [docker file permissions - Google Zoeken](https://www.google.com/search?&q=docker+file+permissions+) .

---

<div class="post-metadata">

### Author: ![come](https://community.baserow.io/letter_avatar_proxy/v4/letter/c/9f8e36/32.png) [@come](https://community.baserow.io/u/come)
#### Post date: [September 14, 2022, 2:54pm UTC](https://community.baserow.io/t/export-import-database/1272/7 "2022-09-14T14:54:40Z")

</div>

Here is my command in the baserow container root user, folder /

./baserow.sh backend-cmd manage export\_workspace\_applications 1

I don’t know how to get my workspace id ?

It’s weird I can create a file by touching in this folder with root user, why baserow.sh can’t ?
