# Cratedb getting table dump and loading the dump

**URL:** <https://community.cratedb.com/t/cratedb-getting-table-dump-and-loading-the-dump/1254>\
**Category:** CrateDB\
**Created:** [October 17, 2022, 5:07pm UTC](https://community.cratedb.com/t/cratedb-getting-table-dump-and-loading-the-dump/1254 "2022-10-17T17:07:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![arafaraf](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/arafaraf/32/540_2.png) [@arafaraf](https://community.cratedb.com/u/arafaraf)\
**Post date:** [October 17, 2022, 5:07pm UTC](https://community.cratedb.com/t/cratedb-getting-table-dump-and-loading-the-dump/1254/1 "2022-10-17T17:07:35Z")

</div>

Hello crate community. Is there any way to get a dump of a table in crateDB. Once I have that dump how would I load that dump into my cratedb instance?

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [October 17, 2022, 5:16pm UTC](https://community.cratedb.com/t/cratedb-getting-table-dump-and-loading-the-dump/1254/2 "2022-10-17T17:16:03Z")

</div>

Builtin there is

- [snapshot repositories](https://crate.io/docs/crate/reference/en/5.0/admin/snapshots.html)
- `COPY TO / FROM` [COPY TO — CrateDB: Reference](https://crate.io/docs/crate/reference/en/5.0/sql/statements/copy-to.html)
- [logical replication](https://crate.io/docs/crate/reference/en/5.0/admin/logical-replication.html)

to copy / replicate tables between clusters. Depending on the amount of data another option might be to use an IDE like DBeaver to autogenerate insert / create statements.

* * *

Could you be more specific what exactly you are trying to achieve?

---

<div class="post-metadata">

**Author:** ![arafaraf](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/arafaraf/32/540_2.png) [@arafaraf](https://community.cratedb.com/u/arafaraf)\
**Post date:** [October 17, 2022, 5:38pm UTC](https://community.cratedb.com/t/cratedb-getting-table-dump-and-loading-the-dump/1254/3 "2022-10-17T17:38:37Z")

</div>

So Basically I have a dev instance of cratedb running. It has a table “scp\_service\_transaction”.“transactions\_v2”. I want to take all the data in that table and put it into my local cratedb instance.

Ive tried

```auto
COPY "scp_service_transaction"."transactions_v2" TO DIRECTORY '~/' with (compression='gzip');

```

But I am getting the error

```auto
Error!

NotSerializableExceptionWrapper[unhandled_server_exception: Failed to open output: '~/transactions_v2_2_.json.gz (No such file or directory)']

```

---

<div class="post-metadata">

**Author:** ![amotl](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/amotl/32/617_2.png) [@amotl](https://community.cratedb.com/u/amotl)\
**Post date:** [October 17, 2022, 5:45pm UTC](https://community.cratedb.com/t/cratedb-getting-table-dump-and-loading-the-dump/1254/4 "2022-10-17T17:45:07Z")

</div>

Hi @arafaraf.

> [@arafaraf](#):
>
> `TO DIRECTORY '~/'`

I am not completely sure about it, but I believe CrateDB will not support the `~/` idiom for addressing the home directory of the current user. That’s usually something only [shells](https://en.wikipedia.org/wiki/Shell_(computing)) do.

With kind regards,  
Andreas.

---

<div class="post-metadata">

**Author:** ![arafaraf](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/arafaraf/32/540_2.png) [@arafaraf](https://community.cratedb.com/u/arafaraf)\
**Post date:** [October 17, 2022, 5:59pm UTC](https://community.cratedb.com/t/cratedb-getting-table-dump-and-loading-the-dump/1254/5 "2022-10-17T17:59:18Z")

</div>

I even tried

```auto
COPY "scp_service_transaction"."transactions_v2" TO DIRECTORY '~/temp/' with (compression='gzip');

```

and I am getting

```auto
Error!

UnhandledServerException[Failed to open output: '~/temp/transactions_v2_2_.json.gz (No such file or directory)']

```

---

<div class="post-metadata">

**Author:** ![proddata](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/proddata/32/1379_2.png) [@proddata](https://community.cratedb.com/u/proddata)\
**Post date:** [October 17, 2022, 6:09pm UTC](https://community.cratedb.com/t/cratedb-getting-table-dump-and-loading-the-dump/1254/6 "2022-10-17T18:09:28Z")

</div>

Could you try the full path:

e.g.

```sql
COPY "scp_service_transaction"."transactions_v2" TO DIRECTORY '/home/username/temp/' with (compression='gzip');

```

instead of

```sql
COPY "scp_service_transaction"."transactions_v2" TO DIRECTORY '~/temp/' with (compression='gzip');

```
