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 os
  
  import lancedb
  import pytest
  
  # AWS:
  # You need to setup AWS credentials an a base path to run this test. Example
  #    AWS_PROFILE=default TEST_S3_BASE_URL=s3://my_bucket/dataset pytest tests/test_io.py
  #
  # Azure:
  # You need to setup Azure credentials an a base path to run this test. Example
  #   export AZURE_STORAGE_ACCOUNT_NAME="<account>"
  #   export AZURE_STORAGE_ACCOUNT_KEY="<key>"
  #   export REMOTE_BASE_URL=az://my_blob/dataset
  #   pytest tests/test_io.py
  
  
  @pytest.fixture(autouse=True, scope="module")
  def setup():
      yield
  
      if remote_url := os.environ.get("REMOTE_BASE_URL"):
          db = lancedb.connect(remote_url)
  
          for table in db.table_names():
              db.drop_table(table)
  
  
  @pytest.mark.skipif(
      (os.environ.get("REMOTE_BASE_URL") is None),
      reason="please setup remote base url",
  )
  def test_remote_io():
      db = lancedb.connect(os.environ.get("REMOTE_BASE_URL"))
      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
  
apis: lancedb.connect
extract_api: [((1069, 1113), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)', 'scope': '"""module"""'}), "(autouse=True, scope='module')\n", (1083, 1113), False, 'import pytest\n'), ((1159, 1192), 'os.environ.get', 'os.environ.get', (['"""REMOTE_BASE_URL"""'], {}), "('REMOTE_BASE_URL')\n", (1173, 1192), False, 'import os\n'), ((1207, 1234), 'lancedb.connect', 'lancedb.connect', (['remote_url'], {}), '(remote_url)\n', (1222, 1234), False, 'import lancedb\n'), ((1472, 1505), 'os.environ.get', 'os.environ.get', (['"""REMOTE_BASE_URL"""'], {}), "('REMOTE_BASE_URL')\n", (1486, 1505), False, 'import os\n'), ((1336, 1369), 'os.environ.get', 'os.environ.get', (['"""REMOTE_BASE_URL"""'], {}), "('REMOTE_BASE_URL')\n", (1350, 1369), False, 'import os\n')]