Compare commits

...

11 Commits

Author SHA1 Message Date
Chang She
3ba7fa15a4 bump version for v0.0.4 2023-04-18 09:20:53 -07:00
Chang She
370867836c Merge pull request #25 from lancedb/gsilvestrin-patch-1
Update README.md
2023-04-18 09:19:40 -07:00
gsilvestrin
682f09480c Update README.md 2023-04-17 12:30:04 -07:00
gsilvestrin
cd8807bc97 bugfix for LanceTable.add to convert python lists 2023-04-17 08:48:56 -07:00
gsilvestrin
41c44ae92e Update README.md 2023-04-14 16:57:51 -07:00
gsilvestrin
6865d66d37 renaming test case 2023-04-14 16:32:31 -07:00
gsilvestrin
aeecd809cc bugfix for LanceTable.add to convert python lists into arrow fixed size lists
- Fixed `add` unit test to create the correct expected result
- Added a unit test for LanceTable.add
- Need to discuss if len(LanceTable) is handled correctly
2023-04-14 14:13:01 -07:00
Chang She
3360678d60 Merge pull request #19 from lancedb/jaichopra/notebook-imp-2
add more explanations to the notebook
2023-03-31 14:01:11 -07:00
Jai Chopra
177eddfc20 add more explanations to the notebook 2023-03-31 13:05:24 -07:00
Chang She
d735a69b6e Merge pull request #18 from lancedb/changhiskhan/notebook-updates 2023-03-30 20:16:13 -07:00
Chang She
a2bd2854e1 update tutorial notebook based on feedback 2023-03-30 19:44:39 -07:00
5 changed files with 144 additions and 45 deletions

View File

@@ -41,6 +41,7 @@ pip install lancedb
```python
import lancedb
uri = "/tmp/lancedb"
db = lancedb.connect(uri)
table = db.create_table("my_table",
data=[{"vector": [3.1, 4.1], "item": "foo", "price": 10.0},

File diff suppressed because one or more lines are too long

View File

@@ -171,6 +171,7 @@ def _sanitize_schema(data: pa.Table, schema: pa.Schema = None) -> pa.Table:
return data
# cast the columns to the expected types
data = data.combine_chunks()
data = _sanitize_vector_column(data, vector_column_name=VECTOR_COLUMN_NAME)
return pa.Table.from_arrays(
[data[name] for name in schema.names], schema=schema
)

View File

@@ -1,6 +1,6 @@
[project]
name = "lancedb"
version = "0.0.3"
version = "0.0.4"
dependencies = ["pylance", "ratelimiter", "retry", "tqdm"]
description = "lancedb"
authors = [

View File

@@ -46,17 +46,17 @@ def test_basic(db):
assert table.to_lance().to_table() == ds.to_table()
def test_add(db):
def test_create_table(db):
schema = pa.schema(
[
pa.field("vector", pa.list_(pa.float32())),
pa.field("vector", pa.list_(pa.float32(), 2)),
pa.field("item", pa.string()),
pa.field("price", pa.float32()),
]
)
expected = pa.Table.from_arrays(
[
pa.array([[3.1, 4.1], [5.9, 26.5]]),
pa.FixedSizeListArray.from_arrays(pa.array([3.1, 4.1, 5.9, 26.5]), 2),
pa.array(["foo", "bar"]),
pa.array([10.0, 20.0]),
],
@@ -79,3 +79,34 @@ def test_add(db):
.to_table()
)
assert expected == tbl
def test_add(db):
table = LanceTable.create(
db,
"test",
data=[
{"vector": [3.1, 4.1], "item": "foo", "price": 10.0},
{"vector": [5.9, 26.5], "item": "bar", "price": 20.0},
],
)
# table = LanceTable(db, "test")
assert len(table) == 2
count = table.add([{"vector": [6.3, 100.5], "item": "new", "price": 30.0}])
assert count == 3
expected = pa.Table.from_arrays(
[
pa.FixedSizeListArray.from_arrays(pa.array([3.1, 4.1, 5.9, 26.5]), 2),
pa.array(["foo", "bar"]),
pa.array([10.0, 20.0]),
],
schema=pa.schema([
pa.field("vector", pa.list_(pa.float32(), 2)),
pa.field("item", pa.string()),
pa.field("price", pa.float64()),
]),
)
assert expected == table.to_arrow()