Skip to content

Commit

Permalink
doc(javascript): minor improvement on docs for table creation
Browse files Browse the repository at this point in the history
Closes #639
  • Loading branch information
changhiskhan committed Dec 21, 2023
1 parent 7bbb287 commit c2e7de1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
24 changes: 16 additions & 8 deletions docs/src/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,26 @@ We'll cover the basics of using LanceDB on your local machine in this section.
tbl = db.create_table("table_from_df", data=df)
```

!!! warning

If the table already exists, LanceDB will raise an error by default.
If you want to overwrite the table, you can pass in `mode="overwrite"`
to the `createTable` function.

=== "Javascript"
```javascript
const tb = await db.createTable("my_table",
data=[{"vector": [3.1, 4.1], "item": "foo", "price": 10.0},
{"vector": [5.9, 26.5], "item": "bar", "price": 20.0}])
const tb = await db.createTable(
"my_table",
[{"vector": [3.1, 4.1], "item": "foo", "price": 10.0},
{"vector": [5.9, 26.5], "item": "bar", "price": 20.0}])
```

!!! warning

If the table already exists, LanceDB will raise an error by default.
If you want to overwrite the table, you can pass in `mode="overwrite"`
to the `createTable` function.
!!! warning

If the table already exists, LanceDB will raise an error by default.
If you want to overwrite the table, you can pass in `"overwrite"`
to the `createTable` function like this: `await con.createTable(tableName, data, { writeMode: WriteMode.Overwrite })`

??? info "Under the hood, LanceDB is converting the input data into an Apache Arrow table and persisting it to disk in [Lance format](https://www.github.com/lancedb/lance)."

Expand Down
4 changes: 2 additions & 2 deletions docs/src/guides/tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ A Table is a collection of Records in a LanceDB Database. You can follow along o
```javascript
data
const tb = await db.createTable("my_table",
data=[{"vector": [3.1, 4.1], "item": "foo", "price": 10.0},
{"vector": [5.9, 26.5], "item": "bar", "price": 20.0}])
[{"vector": [3.1, 4.1], "item": "foo", "price": 10.0},
{"vector": [5.9, 26.5], "item": "bar", "price": 20.0}])
```

!!! info "Note"
Expand Down

0 comments on commit c2e7de1

Please sign in to comment.