# How to export a VIEW with COPY TO?

**URL:** <https://community.cratedb.com/t/how-to-export-a-view-with-copy-to/1269>\
**Category:** CrateDB\
**Created:** [October 27, 2022, 2:28pm UTC](https://community.cratedb.com/t/how-to-export-a-view-with-copy-to/1269 "2022-10-27T14:28:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tenforward](https://avatars.discourse-cdn.com/v4/letter/t/b19c9b/32.png) [@tenforward](https://community.cratedb.com/u/tenforward)\
**Post date:** [October 27, 2022, 2:28pm UTC](https://community.cratedb.com/t/how-to-export-a-view-with-copy-to/1269/1 "2022-10-27T14:28:17Z")

</div>

I would like to export data of a VIEW to a file. Is this possible with COPY TO?  
So far I haven’t found a solution for this.

---

<div class="post-metadata">

**Author:** ![hammerhead](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/hammerhead/32/270_2.png) [@hammerhead](https://community.cratedb.com/u/hammerhead)\
**Post date:** [October 27, 2022, 2:41pm UTC](https://community.cratedb.com/t/how-to-export-a-view-with-copy-to/1269/2 "2022-10-27T14:41:05Z")

</div>

Hi @tenforward,

`COPY TO` currently doesn’t support views, unfortunately. There is an open feature request, please feel free to express your interest there as well: [copy to support "view" · Issue #7930 · crate/crate · GitHub](https://github.com/crate/crate/issues/7930)

A workaround would be to copy the view to a table and then use `COPY TO` on that table:

```auto
CREATE VIEW v1 AS SELECT 1;

CREATE TABLE doc.tmp AS
SELECT *
FROM v1;

COPY doc.tmp TO DIRECTORY 'file:///tmp/';

```
