Skip to content

Conversation

@anubhav756
Copy link
Contributor

@anubhav756 anubhav756 commented Sep 18, 2024

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.

@anubhav756 anubhav756 force-pushed the consolidate-pg-providers branch 5 times, most recently from a81435a to 1845874 Compare September 18, 2024 18:22
@anubhav756 anubhav756 marked this pull request as ready for review September 18, 2024 18:25
@anubhav756 anubhav756 requested a review from a team as a code owner September 18, 2024 18:25
@anubhav756 anubhav756 enabled auto-merge (squash) September 18, 2024 18:26
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.
Copy link
Contributor

@vishwarajanand vishwarajanand left a 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 anubhav756 merged commit a3b2c42 into main Sep 19, 2024
@anubhav756 anubhav756 deleted the consolidate-pg-providers branch September 19, 2024 09:55
@kurtisvg
Copy link
Collaborator

@anubhav756 Let's be careful about enabling automerge when having multiple reviewers

)
assert res == expected
assert sql is None
assert sql is not None
Copy link
Collaborator

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
Copy link
Collaborator

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

anubhav756 pushed a commit that referenced this pull request Dec 3, 2024
🤖 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants