Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support passing sqlalchemy.URL for connection string in Postgres #13123

Merged
merged 2 commits into from May 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,5 +1,5 @@
import logging
from typing import Any, List, NamedTuple, Optional, Type
from typing import Any, List, NamedTuple, Optional, Type, Union

import asyncpg # noqa
import pgvector # noqa
Expand Down Expand Up @@ -135,8 +135,8 @@ class PGVectorStore(BasePydanticVectorStore):
stores_text = True
flat_metadata = False

connection_string: str
async_connection_string: str
connection_string: Union[str, sqlalchemy.URL]
async_connection_string: Union[str, sqlalchemy.URL]
table_name: str
schema_name: str
embed_dim: int
Expand All @@ -157,8 +157,8 @@ class PGVectorStore(BasePydanticVectorStore):

def __init__(
self,
connection_string: str,
async_connection_string: str,
connection_string: Union[str, sqlalchemy.URL],
async_connection_string: Union[str, sqlalchemy.URL],
table_name: str,
schema_name: str,
hybrid_search: bool = False,
Expand Down Expand Up @@ -230,8 +230,8 @@ def from_params(
password: Optional[str] = None,
table_name: str = "llamaindex",
schema_name: str = "public",
connection_string: Optional[str] = None,
async_connection_string: Optional[str] = None,
connection_string: Optional[Union[str, sqlalchemy.URL]] = None,
async_connection_string: Optional[Union[str, sqlalchemy.URL]] = None,
hybrid_search: bool = False,
text_search_config: str = "english",
embed_dim: int = 1536,
Expand Down