> ## Documentation Index
> Fetch the complete documentation index at: https://anaconda.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Vector database

The `.vector_db` accessor provides methods for managing a pgvector database instance:

Method

Return

Description

`.create()`

`VectorDbServerResponse`

Start the vector database and return connection details

`.stop()`

`VectorDbServerResponse`

Stop the vector database (data preserved)

`.delete()`

`None`

Permanently delete the vector database and all data

`.get_tables()`

`List[TableInfo]`

List all tables in the vector database

`.create_table(table, schema)`

`None`

Create a new table with the specified schema

`.drop_table(table)`

`None`

Drop a table from the vector database

> [!NOTE]
>
> Vector database functionality is only supported by the `anaconda-desktop` backend. The `ai-catalyst` backend does not support vector database operations.

### Example usage

```py theme={null}
from anaconda_ai import AnacondaAIClient

client = AnacondaAIClient(backend='anaconda-desktop')

# Start the vector database
db_info = client.vector_db.create()
print(f"Database running at: {db_info.uri}")

# Create a table for embeddings
schema = VectorDbTableSchema(columns=[
    VectorDbTableColumn(name="id", type="SERIAL", constraints=["PRIMARY KEY"]),
    VectorDbTableColumn(name="embedding", type="vector(384)")
])
client.vector_db.create_table("my_embeddings", schema)

# List tables
tables = client.vector_db.get_tables()
for table in tables:
    print(f"Table: {table.name}, Rows: {table.numRows}")

# Clean up
client.vector_db.drop_table("my_embeddings")
client.vector_db.stop()
```
