hyrax.verbs.database_connection
===============================

.. py:module:: hyrax.verbs.database_connection


Attributes
----------

.. autoapisummary::

   hyrax.verbs.database_connection.logger


Classes
-------

.. autoapisummary::

   hyrax.verbs.database_connection.DatabaseConnection


Module Contents
---------------

.. py:data:: logger

.. py:class:: DatabaseConnection(config)

   Bases: :py:obj:`hyrax.verbs.verb_registry.Verb`


   Verb to create a connection to a vector database with inference results.

   .. py:method:: __init__

   Overall initialization for all verbs that saves the config


   .. py:attribute:: cli_name
      :value: 'database_connection'



   .. py:attribute:: add_parser_kwargs


   .. py:attribute:: description
      :value: 'Create a connection to the vector database for interactive queries.'



   .. py:method:: setup_parser(parser: argparse.ArgumentParser)
      :staticmethod:


      Stub of parser setup



   .. py:method:: run_cli(args: argparse.Namespace | None = None)

      Stub CLI implementation



   .. py:method:: run(database_dir: Union[pathlib.Path, str] | None = None)

      Create a connection to the vector database for interactive queries.

      :param database_dir: The directory containing the database that will be connected to.
                           If None, attempt to connect to the most recently created `...-vector-db-...`
                           directory. If specified, it can point to either an empty directory
                           or a directory containing an existing vector database. If the latter, the
                           database will be updated with the new vectors.
      :type database_dir: str or Path, Optional



   .. py:method:: _get_database_type_from_config(database_dir: pathlib.Path)

      Internal function that will read a config file from a directory and
      return the name of the vector database from it. i.e. "chromadb", "qdrant".

      :param database_dir: The directory containing the vector database and the config file that
                           be used as reference.
      :type database_dir: Path

      :returns: The config value for ["vector_db"]["name"] in the reference config.
      :rtype: str



