You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use PostgreSQL's `COPY` command to read and write from/to Parquet files. Below is an example of how to write a PostgreSQL table, with complex types, into a Parquet file and then to read the Parquet file content back into the same table.
65
67
66
68
```sql
@@ -99,7 +101,9 @@ COPY product_example FROM '/tmp/product_example.parquet';
99
101
SELECT*FROM product_example;
100
102
```
101
103
102
-
You can also use `COPY` command to read and write Parquet stream from/to standard input and output. Below is an example usage (you have to specify `format = parquet`):
You can use `COPY` command to read and write Parquet stream from/to standard input and output. Below is an example usage (you have to specify `format = parquet`):
### COPY from/to Parquet program stream to/from Postgres tables
117
+
118
+
You can use `COPY` command to read and write Parquet stream from/to a program's input and output. Below is an example usage (you have to specify `format = parquet`):
119
+
120
+
```bash
121
+
psql -d pg_parquet -p 28817 -h localhost -c "copy product_example_reconstructed to program 'cat > /tmp/test.parquet' (format parquet);"
122
+
COPY 2
123
+
124
+
psql -d pg_parquet -p 28817 -h localhost -c "copy product_example_reconstructed from program 'cat /tmp/test.parquet' (format parquet);"
125
+
COPY 2
126
+
```
127
+
128
+
112
129
### Inspect Parquet schema
113
130
You can call `SELECT * FROM parquet.schema(<uri>)` to discover the schema of the Parquet file at given uri.
0 commit comments