-
Notifications
You must be signed in to change notification settings - Fork 116
feat: Consolidate postgres providers #493
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
Conversation
a81435a to
1845874
Compare
Create a common PostgresDatastore class to encapsulate all the DB query logic based on a given connection pool. Reuse the same logic across AlloyDB & CloudSQL postgres providers for better code maintainability and less redundancy.
1845874 to
f49b2ca
Compare
vishwarajanand
left a comment
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.
LGTM, approving to unblock..
I checked the queries moved to postgres_datastore seem similar (and do not miss anything obviously) from the queries deleted.
|
@anubhav756 Let's be careful about enabling automerge when having multiple reviewers |
| ) | ||
| assert res == expected | ||
| assert sql is None | ||
| assert sql is not None |
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.
This doesn't seem like a particularly useful check -- we should either remove it or assert the SQL is something expected
| ) -> tuple[list[Any], Optional[str]]: | ||
| async with self.__pool.connect() as conn: | ||
| sql = """ | ||
| SELECT user_name, airline, flight_number, departure_airport, arrival_airport, departure_time, arrival_time FROM tickets |
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.
nit: this is a pretty long line, consider refactoring it onto multiple lines
🤖 I have created a release *beep* *boop* --- ## [0.3.0](v0.2.0...v0.3.0) (2024-12-03) ### Features * Add similarity threshold to amenity search ([#477](#477)) ([c49bef9](c49bef9)) * Add tracing for AlloyDB and CloudSQL Postgres providers ([#494](#494)) ([2fa03bc](2fa03bc)) * Consolidate postgres providers ([#493](#493)) ([a3b2c42](a3b2c42)) * Reuse connector object across different database connections in… ([#487](#487)) ([61c0f52](61c0f52)) * Switch the llm to ChatVertexAI ([#486](#486)) ([479c5e5](479c5e5)) ### Bug Fixes * Add test cases to improve coverage for postgres and over more tools. ([#508](#508)) ([20870ea](20870ea)) * Reuse connector object across different database connections. ([#484](#484)) ([2b05739](2b05739)), closes [#416](#416) * update close client function to async ([#505](#505)) ([b614276](b614276)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Create a common
PostgresDatastoreclass to encapsulate all the DB query logic based on a given connection pool. Reuse the same logic across AlloyDB & CloudSQL Postgres providers for better code maintainability and less redundancy.