code: #  Copyright 2023 LanceDB Developers
  #
  #  Licensed under the Apache License, Version 2.0 (the "License");
  #  you may not use this file except in compliance with the License.
  #  You may obtain a copy of the License at
  #      http://www.apache.org/licenses/LICENSE-2.0
  #
  #  Unless required by applicable law or agreed to in writing, software
  #  distributed under the License is distributed on an "AS IS" BASIS,
  #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  #  See the License for the specific language governing permissions and
  #  limitations under the License.
  
  import re
  from datetime import timedelta
  
  import lancedb
  import numpy as np
  import pandas as pd
  import pyarrow as pa
  import pytest
  from lancedb.pydantic import LanceModel, Vector
  
  
  def test_basic(tmp_path):
      db = lancedb.connect(tmp_path)
  
      assert db.uri == str(tmp_path)
      assert db.table_names() == []
  
      table = db.create_table(
          "test",
          data=[
              {"vector": [3.1, 4.1], "item": "foo", "price": 10.0},
              {"vector": [5.9, 26.5], "item": "bar", "price": 20.0},
          ],
      )
      rs = table.search([100, 100]).limit(1).to_pandas()
      assert len(rs) == 1
      assert rs["item"].iloc[0] == "bar"
  
      rs = table.search([100, 100]).where("price < 15").limit(2).to_pandas()
      assert len(rs) == 1
      assert rs["item"].iloc[0] == "foo"
  
      assert db.table_names() == ["test"]
      assert "test" in db
      assert len(db) == 1
  
      assert db.open_table("test").name == db["test"].name
  
  
  def test_ingest_pd(tmp_path):
      db = lancedb.connect(tmp_path)
  
      assert db.uri == str(tmp_path)
      assert db.table_names() == []
  
      data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["foo", "bar"],
              "price": [10.0, 20.0],
          }
      )
      table = db.create_table("test", data=data)
      rs = table.search([100, 100]).limit(1).to_pandas()
      assert len(rs) == 1
      assert rs["item"].iloc[0] == "bar"
  
      rs = table.search([100, 100]).where("price < 15").limit(2).to_pandas()
      assert len(rs) == 1
      assert rs["item"].iloc[0] == "foo"
  
      assert db.table_names() == ["test"]
      assert "test" in db
      assert len(db) == 1
  
      assert db.open_table("test").name == db["test"].name
  
  
  def test_ingest_iterator(tmp_path):
      class PydanticSchema(LanceModel):
          vector: Vector(2)
          item: str
          price: float
  
      arrow_schema = pa.schema(
          [
              pa.field("vector", pa.list_(pa.float32(), 2)),
              pa.field("item", pa.utf8()),
              pa.field("price", pa.float32()),
          ]
      )
  
      def make_batches():
          for _ in range(5):
              yield from [
                  # pandas
                  pd.DataFrame(
                      {
                          "vector": [[3.1, 4.1], [1, 1]],
                          "item": ["foo", "bar"],
                          "price": [10.0, 20.0],
                      }
                  ),
                  # pylist
                  [
                      {"vector": [3.1, 4.1], "item": "foo", "price": 10.0},
                      {"vector": [5.9, 26.5], "item": "bar", "price": 20.0},
                  ],
                  # recordbatch
                  pa.RecordBatch.from_arrays(
                      [
                          pa.array([[3.1, 4.1], [5.9, 26.5]], pa.list_(pa.float32(), 2)),
                          pa.array(["foo", "bar"]),
                          pa.array([10.0, 20.0]),
                      ],
                      ["vector", "item", "price"],
                  ),
                  # pa Table
                  pa.Table.from_arrays(
                      [
                          pa.array([[3.1, 4.1], [5.9, 26.5]], pa.list_(pa.float32(), 2)),
                          pa.array(["foo", "bar"]),
                          pa.array([10.0, 20.0]),
                      ],
                      ["vector", "item", "price"],
                  ),
                  # pydantic list
                  [
                      PydanticSchema(vector=[3.1, 4.1], item="foo", price=10.0),
                      PydanticSchema(vector=[5.9, 26.5], item="bar", price=20.0),
                  ],
                  # TODO: test pydict separately. it is unique column number and
                  # name constraints
              ]
  
      def run_tests(schema):
          db = lancedb.connect(tmp_path)
          tbl = db.create_table("table2", make_batches(), schema=schema, mode="overwrite")
          tbl.to_pandas()
          assert tbl.search([3.1, 4.1]).limit(1).to_pandas()["_distance"][0] == 0.0
          assert tbl.search([5.9, 26.5]).limit(1).to_pandas()["_distance"][0] == 0.0
          tbl_len = len(tbl)
          tbl.add(make_batches())
          assert tbl_len == 50
          assert len(tbl) == tbl_len * 2
          assert len(tbl.list_versions()) == 3
          db.drop_database()
  
      run_tests(arrow_schema)
      run_tests(PydanticSchema)
  
  
  def test_table_names(tmp_path):
      db = lancedb.connect(tmp_path)
      data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["foo", "bar"],
              "price": [10.0, 20.0],
          }
      )
      db.create_table("test2", data=data)
      db.create_table("test1", data=data)
      db.create_table("test3", data=data)
      assert db.table_names() == ["test1", "test2", "test3"]
  
  
  @pytest.mark.asyncio
  async def test_table_names_async(tmp_path):
      db = lancedb.connect(tmp_path)
      data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["foo", "bar"],
              "price": [10.0, 20.0],
          }
      )
      db.create_table("test2", data=data)
      db.create_table("test1", data=data)
      db.create_table("test3", data=data)
  
      db = await lancedb.connect_async(tmp_path)
      assert await db.table_names() == ["test1", "test2", "test3"]
  
      assert await db.table_names(limit=1) == ["test1"]
      assert await db.table_names(start_after="test1", limit=1) == ["test2"]
      assert await db.table_names(start_after="test1") == ["test2", "test3"]
  
  
  def test_create_mode(tmp_path):
      db = lancedb.connect(tmp_path)
      data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["foo", "bar"],
              "price": [10.0, 20.0],
          }
      )
      db.create_table("test", data=data)
  
      with pytest.raises(Exception):
          db.create_table("test", data=data)
  
      new_data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["fizz", "buzz"],
              "price": [10.0, 20.0],
          }
      )
      tbl = db.create_table("test", data=new_data, mode="overwrite")
      assert tbl.to_pandas().item.tolist() == ["fizz", "buzz"]
  
  
  def test_create_exist_ok(tmp_path):
      db = lancedb.connect(tmp_path)
      data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["foo", "bar"],
              "price": [10.0, 20.0],
          }
      )
      tbl = db.create_table("test", data=data)
  
      with pytest.raises(OSError):
          db.create_table("test", data=data)
  
      # open the table but don't add more rows
      tbl2 = db.create_table("test", data=data, exist_ok=True)
      assert tbl.name == tbl2.name
      assert tbl.schema == tbl2.schema
      assert len(tbl) == len(tbl2)
  
      schema = pa.schema(
          [
              pa.field("vector", pa.list_(pa.float32(), list_size=2)),
              pa.field("item", pa.utf8()),
              pa.field("price", pa.float64()),
          ]
      )
      tbl3 = db.create_table("test", schema=schema, exist_ok=True)
      assert tbl3.schema == schema
  
      bad_schema = pa.schema(
          [
              pa.field("vector", pa.list_(pa.float32(), list_size=2)),
              pa.field("item", pa.utf8()),
              pa.field("price", pa.float64()),
              pa.field("extra", pa.float32()),
          ]
      )
      with pytest.raises(ValueError):
          db.create_table("test", schema=bad_schema, exist_ok=True)
  
  
  @pytest.mark.asyncio
  async def test_connect(tmp_path):
      db = await lancedb.connect_async(tmp_path)
      assert str(db) == f"NativeDatabase(uri={tmp_path}, read_consistency_interval=None)"
  
      db = await lancedb.connect_async(
          tmp_path, read_consistency_interval=timedelta(seconds=5)
      )
      assert str(db) == f"NativeDatabase(uri={tmp_path}, read_consistency_interval=5s)"
  
  
  @pytest.mark.asyncio
  async def test_close(tmp_path):
      db = await lancedb.connect_async(tmp_path)
      assert db.is_open()
      db.close()
      assert not db.is_open()
  
      with pytest.raises(RuntimeError, match="is closed"):
          await db.table_names()
  
  
  @pytest.mark.asyncio
  async def test_create_mode_async(tmp_path):
      db = await lancedb.connect_async(tmp_path)
      data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["foo", "bar"],
              "price": [10.0, 20.0],
          }
      )
      await db.create_table("test", data=data)
  
      with pytest.raises(RuntimeError):
          await db.create_table("test", data=data)
  
      new_data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["fizz", "buzz"],
              "price": [10.0, 20.0],
          }
      )
      _tbl = await db.create_table("test", data=new_data, mode="overwrite")
  
      # MIGRATION: to_pandas() is not available in async
      # assert tbl.to_pandas().item.tolist() == ["fizz", "buzz"]
  
  
  @pytest.mark.asyncio
  async def test_create_exist_ok_async(tmp_path):
      db = await lancedb.connect_async(tmp_path)
      data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["foo", "bar"],
              "price": [10.0, 20.0],
          }
      )
      tbl = await db.create_table("test", data=data)
  
      with pytest.raises(RuntimeError):
          await db.create_table("test", data=data)
  
      # open the table but don't add more rows
      tbl2 = await db.create_table("test", data=data, exist_ok=True)
      assert tbl.name == tbl2.name
      assert await tbl.schema() == await tbl2.schema()
  
      schema = pa.schema(
          [
              pa.field("vector", pa.list_(pa.float32(), list_size=2)),
              pa.field("item", pa.utf8()),
              pa.field("price", pa.float64()),
          ]
      )
      tbl3 = await db.create_table("test", schema=schema, exist_ok=True)
      assert await tbl3.schema() == schema
  
      # Migration: When creating a table, but the table already exists, but
      # the schema is different, it should raise an error.
      # bad_schema = pa.schema(
      #     [
      #         pa.field("vector", pa.list_(pa.float32(), list_size=2)),
      #         pa.field("item", pa.utf8()),
      #         pa.field("price", pa.float64()),
      #         pa.field("extra", pa.float32()),
      #     ]
      # )
      # with pytest.raises(ValueError):
      #     await db.create_table("test", schema=bad_schema, exist_ok=True)
  
  
  @pytest.mark.asyncio
  async def test_open_table(tmp_path):
      db = await lancedb.connect_async(tmp_path)
      data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["foo", "bar"],
              "price": [10.0, 20.0],
          }
      )
      await db.create_table("test", data=data)
  
      tbl = await db.open_table("test")
      assert tbl.name == "test"
      assert (
          re.search(
              r"NativeTable\(test, uri=.*test\.lance, read_consistency_interval=None\)",
              str(tbl),
          )
          is not None
      )
      assert await tbl.schema() == pa.schema(
          {
              "vector": pa.list_(pa.float32(), list_size=2),
              "item": pa.utf8(),
              "price": pa.float64(),
          }
      )
  
      with pytest.raises(ValueError, match="was not found"):
          await db.open_table("does_not_exist")
  
  
  def test_delete_table(tmp_path):
      db = lancedb.connect(tmp_path)
      data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["foo", "bar"],
              "price": [10.0, 20.0],
          }
      )
      db.create_table("test", data=data)
  
      with pytest.raises(Exception):
          db.create_table("test", data=data)
  
      assert db.table_names() == ["test"]
  
      db.drop_table("test")
      assert db.table_names() == []
  
      db.create_table("test", data=data)
      assert db.table_names() == ["test"]
  
      # dropping a table that does not exist should pass
      # if ignore_missing=True
      db.drop_table("does_not_exist", ignore_missing=True)
  
  
  def test_drop_database(tmp_path):
      db = lancedb.connect(tmp_path)
      data = pd.DataFrame(
          {
              "vector": [[3.1, 4.1], [5.9, 26.5]],
              "item": ["foo", "bar"],
              "price": [10.0, 20.0],
          }
      )
      new_data = pd.DataFrame(
          {
              "vector": [[5.1, 4.1], [5.9, 10.5]],
              "item": ["kiwi", "avocado"],
              "price": [12.0, 17.0],
          }
      )
      db.create_table("test", data=data)
      with pytest.raises(Exception):
          db.create_table("test", data=data)
  
      assert db.table_names() == ["test"]
  
      db.create_table("new_test", data=new_data)
      db.drop_database()
      assert db.table_names() == []
  
      # it should pass when no tables are present
      db.create_table("test", data=new_data)
      db.drop_table("test")
      assert db.table_names() == []
      db.drop_database()
      assert db.table_names() == []
  
      # creating an empty database with schema
      schema = pa.schema([pa.field("vector", pa.list_(pa.float32(), list_size=2))])
      db.create_table("empty_table", schema=schema)
      # dropping a empty database should pass
      db.drop_database()
      assert db.table_names() == []
  
  
  def test_empty_or_nonexistent_table(tmp_path):
      db = lancedb.connect(tmp_path)
      with pytest.raises(Exception):
          db.create_table("test_with_no_data")
  
      with pytest.raises(Exception):
          db.open_table("does_not_exist")
  
      schema = pa.schema([pa.field("a", pa.int64(), nullable=False)])
      test = db.create_table("test", schema=schema)
  
      class TestModel(LanceModel):
          a: int
  
      test2 = db.create_table("test2", schema=TestModel)
      assert test.schema == test2.schema
  
  
  def test_replace_index(tmp_path):
      db = lancedb.connect(uri=tmp_path)
      table = db.create_table(
          "test",
          [
              {"vector": np.random.rand(128), "item": "foo", "price": float(i)}
              for i in range(1000)
          ],
      )
      table.create_index(
          num_partitions=2,
          num_sub_vectors=4,
      )
  
      with pytest.raises(Exception):
          table.create_index(
              num_partitions=2,
              num_sub_vectors=4,
              replace=False,
          )
  
      table.create_index(
          num_partitions=2,
          num_sub_vectors=4,
          replace=True,
          index_cache_size=10,
      )
  
  
  def test_prefilter_with_index(tmp_path):
      db = lancedb.connect(uri=tmp_path)
      data = [
          {"vector": np.random.rand(128), "item": "foo", "price": float(i)}
          for i in range(1000)
      ]
      sample_key = data[100]["vector"]
      table = db.create_table(
          "test",
          data,
      )
      table.create_index(
          num_partitions=2,
          num_sub_vectors=4,
      )
      table = (
          table.search(sample_key)
          .where("price == 500", prefilter=True)
          .limit(5)
          .to_arrow()
      )
      assert table.num_rows == 1
  
apis: lancedb.pydantic.Vector lancedb.connect lancedb.connect_async
extract_api: [((807, 832), 'lancedb.connect', 'lancedb.connect', (['tmp_path'], {}), '(tmp_path)\n', (822, 832), False, 'import lancedb\n'), ((1559, 1584), 'lancedb.connect', 'lancedb.connect', (['tmp_path'], {}), '(tmp_path)\n', (1574, 1584), False, 'import lancedb\n'), ((1667, 1769), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'],\n    'price': [10.0, 20.0]})\n", (1679, 1769), True, 'import pandas as pd\n'), ((4917, 4942), 'lancedb.connect', 'lancedb.connect', (['tmp_path'], {}), '(tmp_path)\n', (4932, 4942), False, 'import lancedb\n'), ((4954, 5056), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'],\n    'price': [10.0, 20.0]})\n", (4966, 5056), True, 'import pandas as pd\n'), ((5369, 5394), 'lancedb.connect', 'lancedb.connect', (['tmp_path'], {}), '(tmp_path)\n', (5384, 5394), False, 'import lancedb\n'), ((5406, 5508), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'],\n    'price': [10.0, 20.0]})\n", (5418, 5508), True, 'import pandas as pd\n'), ((6047, 6072), 'lancedb.connect', 'lancedb.connect', (['tmp_path'], {}), '(tmp_path)\n', (6062, 6072), False, 'import lancedb\n'), ((6084, 6186), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'],\n    'price': [10.0, 20.0]})\n", (6096, 6186), True, 'import pandas as pd\n'), ((6378, 6482), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['fizz', 'buzz'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['fizz', 'buzz'],\n    'price': [10.0, 20.0]})\n", (6390, 6482), True, 'import pandas as pd\n'), ((6715, 6740), 'lancedb.connect', 'lancedb.connect', (['tmp_path'], {}), '(tmp_path)\n', (6730, 6740), False, 'import lancedb\n'), ((6752, 6854), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'],\n    'price': [10.0, 20.0]})\n", (6764, 6854), True, 'import pandas as pd\n'), ((8676, 8778), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'],\n    'price': [10.0, 20.0]})\n", (8688, 8778), True, 'import pandas as pd\n'), ((8985, 9089), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['fizz', 'buzz'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['fizz', 'buzz'],\n    'price': [10.0, 20.0]})\n", (8997, 9089), True, 'import pandas as pd\n'), ((9469, 9571), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'],\n    'price': [10.0, 20.0]})\n", (9481, 9571), True, 'import pandas as pd\n'), ((10917, 11019), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'],\n    'price': [10.0, 20.0]})\n", (10929, 11019), True, 'import pandas as pd\n'), ((11713, 11738), 'lancedb.connect', 'lancedb.connect', (['tmp_path'], {}), '(tmp_path)\n', (11728, 11738), False, 'import lancedb\n'), ((11750, 11852), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'],\n    'price': [10.0, 20.0]})\n", (11762, 11852), True, 'import pandas as pd\n'), ((12397, 12422), 'lancedb.connect', 'lancedb.connect', (['tmp_path'], {}), '(tmp_path)\n', (12412, 12422), False, 'import lancedb\n'), ((12434, 12536), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'], 'price': [\n    10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [5.9, 26.5]], 'item': ['foo', 'bar'],\n    'price': [10.0, 20.0]})\n", (12446, 12536), True, 'import pandas as pd\n'), ((12609, 12716), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[5.1, 4.1], [5.9, 10.5]], 'item': ['kiwi', 'avocado'], 'price':\n    [12.0, 17.0]}"], {}), "({'vector': [[5.1, 4.1], [5.9, 10.5]], 'item': ['kiwi',\n    'avocado'], 'price': [12.0, 17.0]})\n", (12621, 12716), True, 'import pandas as pd\n'), ((13583, 13608), 'lancedb.connect', 'lancedb.connect', (['tmp_path'], {}), '(tmp_path)\n', (13598, 13608), False, 'import lancedb\n'), ((14073, 14102), 'lancedb.connect', 'lancedb.connect', ([], {'uri': 'tmp_path'}), '(uri=tmp_path)\n', (14088, 14102), False, 'import lancedb\n'), ((14718, 14747), 'lancedb.connect', 'lancedb.connect', ([], {'uri': 'tmp_path'}), '(uri=tmp_path)\n', (14733, 14747), False, 'import lancedb\n'), ((2370, 2379), 'lancedb.pydantic.Vector', 'Vector', (['(2)'], {}), '(2)\n', (2376, 2379), False, 'from lancedb.pydantic import LanceModel, Vector\n'), ((4312, 4337), 'lancedb.connect', 'lancedb.connect', (['tmp_path'], {}), '(tmp_path)\n', (4327, 4337), False, 'import lancedb\n'), ((5702, 5733), 'lancedb.connect_async', 'lancedb.connect_async', (['tmp_path'], {}), '(tmp_path)\n', (5723, 5733), False, 'import lancedb\n'), ((6293, 6317), 'pytest.raises', 'pytest.raises', (['Exception'], {}), '(Exception)\n', (6306, 6317), False, 'import pytest\n'), ((6967, 6989), 'pytest.raises', 'pytest.raises', (['OSError'], {}), '(OSError)\n', (6980, 6989), False, 'import pytest\n'), ((7812, 7837), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (7825, 7837), False, 'import pytest\n'), ((7977, 8008), 'lancedb.connect_async', 'lancedb.connect_async', (['tmp_path'], {}), '(tmp_path)\n', (7998, 8008), False, 'import lancedb\n'), ((8363, 8394), 'lancedb.connect_async', 'lancedb.connect_async', (['tmp_path'], {}), '(tmp_path)\n', (8384, 8394), False, 'import lancedb\n'), ((8472, 8518), 'pytest.raises', 'pytest.raises', (['RuntimeError'], {'match': '"""is closed"""'}), "(RuntimeError, match='is closed')\n", (8485, 8518), False, 'import pytest\n'), ((8633, 8664), 'lancedb.connect_async', 'lancedb.connect_async', (['tmp_path'], {}), '(tmp_path)\n', (8654, 8664), False, 'import lancedb\n'), ((8891, 8918), 'pytest.raises', 'pytest.raises', (['RuntimeError'], {}), '(RuntimeError)\n', (8904, 8918), False, 'import pytest\n'), ((9426, 9457), 'lancedb.connect_async', 'lancedb.connect_async', (['tmp_path'], {}), '(tmp_path)\n', (9447, 9457), False, 'import lancedb\n'), ((9690, 9717), 'pytest.raises', 'pytest.raises', (['RuntimeError'], {}), '(RuntimeError)\n', (9703, 9717), False, 'import pytest\n'), ((10874, 10905), 'lancedb.connect_async', 'lancedb.connect_async', (['tmp_path'], {}), '(tmp_path)\n', (10895, 10905), False, 'import lancedb\n'), ((11573, 11621), 'pytest.raises', 'pytest.raises', (['ValueError'], {'match': '"""was not found"""'}), "(ValueError, match='was not found')\n", (11586, 11621), False, 'import pytest\n'), ((11959, 11983), 'pytest.raises', 'pytest.raises', (['Exception'], {}), '(Exception)\n', (11972, 11983), False, 'import pytest\n'), ((12822, 12846), 'pytest.raises', 'pytest.raises', (['Exception'], {}), '(Exception)\n', (12835, 12846), False, 'import pytest\n'), ((13618, 13642), 'pytest.raises', 'pytest.raises', (['Exception'], {}), '(Exception)\n', (13631, 13642), False, 'import pytest\n'), ((13699, 13723), 'pytest.raises', 'pytest.raises', (['Exception'], {}), '(Exception)\n', (13712, 13723), False, 'import pytest\n'), ((14379, 14403), 'pytest.raises', 'pytest.raises', (['Exception'], {}), '(Exception)\n', (14392, 14403), False, 'import pytest\n'), ((14780, 14799), 'numpy.random.rand', 'np.random.rand', (['(128)'], {}), '(128)\n', (14794, 14799), True, 'import numpy as np\n'), ((2548, 2557), 'pyarrow.utf8', 'pa.utf8', ([], {}), '()\n', (2555, 2557), True, 'import pyarrow as pa\n'), ((2590, 2602), 'pyarrow.float32', 'pa.float32', ([], {}), '()\n', (2600, 2602), True, 'import pyarrow as pa\n'), ((7377, 7386), 'pyarrow.utf8', 'pa.utf8', ([], {}), '()\n', (7384, 7386), True, 'import pyarrow as pa\n'), ((7419, 7431), 'pyarrow.float64', 'pa.float64', ([], {}), '()\n', (7429, 7431), True, 'import pyarrow as pa\n'), ((7685, 7694), 'pyarrow.utf8', 'pa.utf8', ([], {}), '()\n', (7692, 7694), True, 'import pyarrow as pa\n'), ((7727, 7739), 'pyarrow.float64', 'pa.float64', ([], {}), '()\n', (7737, 7739), True, 'import pyarrow as pa\n'), ((7772, 7784), 'pyarrow.float32', 'pa.float32', ([], {}), '()\n', (7782, 7784), True, 'import pyarrow as pa\n'), ((8180, 8200), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(5)'}), '(seconds=5)\n', (8189, 8200), False, 'from datetime import timedelta\n'), ((10100, 10109), 'pyarrow.utf8', 'pa.utf8', ([], {}), '()\n', (10107, 10109), True, 'import pyarrow as pa\n'), ((10142, 10154), 'pyarrow.float64', 'pa.float64', ([], {}), '()\n', (10152, 10154), True, 'import pyarrow as pa\n'), ((11501, 11510), 'pyarrow.utf8', 'pa.utf8', ([], {}), '()\n', (11508, 11510), True, 'import pyarrow as pa\n'), ((11533, 11545), 'pyarrow.float64', 'pa.float64', ([], {}), '()\n', (11543, 11545), True, 'import pyarrow as pa\n'), ((13804, 13814), 'pyarrow.int64', 'pa.int64', ([], {}), '()\n', (13812, 13814), True, 'import pyarrow as pa\n'), ((14181, 14200), 'numpy.random.rand', 'np.random.rand', (['(128)'], {}), '(128)\n', (14195, 14200), True, 'import numpy as np\n'), ((2500, 2512), 'pyarrow.float32', 'pa.float32', ([], {}), '()\n', (2510, 2512), True, 'import pyarrow as pa\n'), ((2739, 2836), 'pandas.DataFrame', 'pd.DataFrame', (["{'vector': [[3.1, 4.1], [1, 1]], 'item': ['foo', 'bar'], 'price': [10.0, 20.0]}"], {}), "({'vector': [[3.1, 4.1], [1, 1]], 'item': ['foo', 'bar'],\n    'price': [10.0, 20.0]})\n", (2751, 2836), True, 'import pandas as pd\n'), ((7319, 7331), 'pyarrow.float32', 'pa.float32', ([], {}), '()\n', (7329, 7331), True, 'import pyarrow as pa\n'), ((7627, 7639), 'pyarrow.float32', 'pa.float32', ([], {}), '()\n', (7637, 7639), True, 'import pyarrow as pa\n'), ((10042, 10054), 'pyarrow.float32', 'pa.float32', ([], {}), '()\n', (10052, 10054), True, 'import pyarrow as pa\n'), ((11453, 11465), 'pyarrow.float32', 'pa.float32', ([], {}), '()\n', (11463, 11465), True, 'import pyarrow as pa\n'), ((13344, 13356), 'pyarrow.float32', 'pa.float32', ([], {}), '()\n', (13354, 13356), True, 'import pyarrow as pa\n'), ((3386, 3410), 'pyarrow.array', 'pa.array', (["['foo', 'bar']"], {}), "(['foo', 'bar'])\n", (3394, 3410), True, 'import pyarrow as pa\n'), ((3436, 3458), 'pyarrow.array', 'pa.array', (['[10.0, 20.0]'], {}), '([10.0, 20.0])\n', (3444, 3458), True, 'import pyarrow as pa\n'), ((3750, 3774), 'pyarrow.array', 'pa.array', (["['foo', 'bar']"], {}), "(['foo', 'bar'])\n", (3758, 3774), True, 'import pyarrow as pa\n'), ((3800, 3822), 'pyarrow.array', 'pa.array', (['[10.0, 20.0]'], {}), '([10.0, 20.0])\n', (3808, 3822), True, 'import pyarrow as pa\n'), ((3343, 3355), 'pyarrow.float32', 'pa.float32', ([], {}), '()\n', (3353, 3355), True, 'import pyarrow as pa\n'), ((3707, 3719), 'pyarrow.float32', 'pa.float32', ([], {}), '()\n', (3717, 3719), True, 'import pyarrow as pa\n')]