mirror of
https://github.com/lancedb/lancedb.git
synced 2026-01-05 19:32:56 +00:00
feat(node): support table.schema for LocalTable (#789)
Close #773 we pass an empty table over IPC so we don't need to manually deal with serde. Then we just return the schema attribute from the empty table. --------- Co-authored-by: albertlockett <albert.lockett@gmail.com>
This commit is contained in:
@@ -498,6 +498,27 @@ describe('LanceDB client', function () {
|
||||
assert.equal(results.length, 2)
|
||||
})
|
||||
})
|
||||
|
||||
describe('when inspecting the schema', function () {
|
||||
it('should return the schema', async function () {
|
||||
const uri = await createTestDB()
|
||||
const db = await lancedb.connect(uri)
|
||||
// the fsl inner field must be named 'item' and be nullable
|
||||
const expectedSchema = new Schema(
|
||||
[
|
||||
new Field('id', new Int32()),
|
||||
new Field('vector', new FixedSizeList(128, new Field('item', new Float32(), true))),
|
||||
new Field('s', new Utf8())
|
||||
]
|
||||
)
|
||||
const table = await db.createTable({
|
||||
name: 'some_table',
|
||||
schema: expectedSchema
|
||||
})
|
||||
const schema = await table.schema
|
||||
assert.deepEqual(expectedSchema, schema)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('Remote LanceDB client', function () {
|
||||
|
||||
Reference in New Issue
Block a user