Skip to content

Commit 542381d

Browse files
feat: Example of nodelocal import
1 parent 673338b commit 542381d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -172,13 +172,29 @@ CSV DATA (
172172
WITH skip='1', nullif = '', allow_quoted_null;
173173
```
174174

175-
If you're working with a remote database, try importing the CSV file as follows:
175+
If you're working with a remote database and have access to the `psql` binary, try importing the CSV file as follows:
176176

177177
``` sh
178178
psql "postgres://root@localhost:26257/defaultdb?sslmode=disable" \
179179
-c "\COPY public.person (id, full_name, date_of_birth, user_type, favourite_animal) FROM './csvs/person/person.csv' WITH DELIMITER ',' CSV HEADER NULL E''"
180180
```
181181

182+
If you're working with a remote database and have access to the `cockroach` binary, try importing the CSV file as follows:
183+
184+
``` sh
185+
cockroach nodelocal upload ./csvs/person/person.csv imports/person.csv \
186+
--url "postgres://root@localhost:26257?sslmode=disable"
187+
```
188+
189+
Then importing the file as follows:
190+
191+
``` sql
192+
IMPORT INTO person ("id", "full_name", "date_of_birth", "user_type", "favourite_animal")
193+
CSV DATA (
194+
'nodelocal://1/imports/person.csv'
195+
) WITH skip = '1';
196+
```
197+
182198
### Tables
183199

184200
Table elements instruct dg to generate data for a single table and output it as a csv file. Here are the configuration options for a table:

0 commit comments

Comments
 (0)