-
Notifications
You must be signed in to change notification settings - Fork 33
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
Feat: add support for initializing vecs client with custom schema #63
base: main
Are you sure you want to change the base?
Changes from all commits
bc28230
0745093
fed1fce
06ec1bd
ee178ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
import vecs | ||
|
||
PYTEST_DB = "postgresql://postgres:password@localhost:5611/vecs_db" | ||
PYTEST_SCHEMA = "test_schema" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the best way to test that escaping is done correctly in all places is to use a crazy schema name. I tested basic operations with the schema name "esCape Me!" and the test suite fails. To reproduce that, try:
and you'll get
|
||
|
||
|
||
@pytest.fixture(scope="session") | ||
|
@@ -95,6 +96,7 @@ def clean_db(maybe_start_pg: None) -> Generator[str, None, None]: | |
eng = create_engine(PYTEST_DB) | ||
with eng.begin() as connection: | ||
connection.execute(text("drop schema if exists vecs cascade;")) | ||
connection.execute(text(f"drop schema if exists {PYTEST_SCHEMA} cascade;")) | ||
yield PYTEST_DB | ||
eng.dispose() | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,5 +24,8 @@ | |
|
||
|
||
def create_client(connection_string: str) -> Client: | ||
"""Creates a client from a Postgres connection string""" | ||
return Client(connection_string) | ||
""" | ||
Creates a client from a Postgres connection string and optional schema. | ||
Defaults to `vecs` schema. | ||
Comment on lines
+28
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
can be removed |
||
""" | ||
return Client(connection_string=connection_string) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the rationale for this change?