Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sstalin committed Nov 3, 2023
1 parent 97ceea2 commit e6af588
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/pages/filetransfer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ line in a file using the modifier `OFFSET 2`, and load `n` records from the file
COPY 100 RECORDS OFFSET 2 INTO mytable FROM 'data.csv' ON CLIENT
```
, for detailed documentation on `COPY INTO` statement please vist [MonetDB documentation](https://www.monetdb.org/documentation-Jun2023/user-guide/sql-manual/data-loading/)
## Example
## Examples
### Upload from file
Assume `data.csv` with the following content
```bash
cat<<EOF>data.csv
Expand All @@ -29,7 +30,7 @@ cat<<EOF>data.csv
3|three
EOF
```
, then load that into MonetDB
, then upload that into MonetDB
```ts
import {Connection} from 'monetdb';
Expand All @@ -41,3 +42,11 @@ res = await conn.execute('select * from foo order by i');
console.log(res.data);
// [[1, 'one'], [2, 'two'], [3, 'three']]
```
### Download to file
```ts
// Download
const ready = await conn.connect();
let res = await conn.execute('copy (select * from sys.generate_series(1,1001)) into \'foo.csv\' on client');
console.log(res.affectedRows);
// 1000
```

0 comments on commit e6af588

Please sign in to comment.