Skip to content

Commit

Permalink
Use alter=True for inserts
Browse files Browse the repository at this point in the history
Refs #74
  • Loading branch information
simonw authored Feb 8, 2024
1 parent 0d4e659 commit 56f3f2c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions webworker.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ async function startDatasette(settings) {
with open("csv.csv", "wb") as fp:
fp.write(await response.bytes())
db[bit].insert_all(
tracker.wrap(rows_from_file(open("csv.csv", "rb"), Format.CSV)[0])
tracker.wrap(rows_from_file(open("csv.csv", "rb"), Format.CSV)[0]),
alter=True
)
db[bit].transform(
types=tracker.types
Expand Down Expand Up @@ -143,7 +144,7 @@ async function startDatasette(settings) {
json_data = value
break
assert isinstance(json_data, list), "JSON data must be a list of objects"
db[bit].insert_all(json_data, pk=pk)
db[bit].insert_all(json_data, pk=pk, alter=True)
elif source_type == "parquet":
await micropip.install("fastparquet")
import fastparquet
Expand Down

0 comments on commit 56f3f2c

Please sign in to comment.