You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most of our SQL queries are dynamically generated using squirrel to build the queries at runtime. The sqlc library allows you write pure SQL and have Golang code generated for you, and we've had good experiences using this library in COP and elsewhere.
All of policy in the opentdf/platform was built with a tool called squirrel to write PostgreSQL queries programmatically in Go. A new tool called sqlc to write queries directly in SQL and generate the Go code was identified, tested in COP and proven to be useful, and advocated for by larger companies like ngrok at Gophercon.
squirrel got us to the initial release of platform v2 in the time needed
Squirrel was familiar to our team and not a new technology under a tight time constraint
Sqlc was proven out in COP and has already been utilized in policy for kas-registry and the GetAttributesByValueFqns service to service (KAS/authz) API, and resource-mapping-groups
The authoring of SQL queries directly when utilizing sqlc means it’s better to read and better to write
Due to directly writing SQL, we can share specific queries with concerned and poky customers
Due to directly writing SQL, we can write really performant queries without the limitations we have with squirrel (no support for CTEs or subqueries leads to not using them or challenging spaghetti code)
The text was updated successfully, but these errors were encountered:
ryanulit
changed the title
Epic: Migrate Policy SQL database queries to sqlc
Epic: Migrate Policy SQL database queries to sqlc
Aug 22, 2024
Problem Statement
Most of our SQL queries are dynamically generated using squirrel to build the queries at runtime. The sqlc library allows you write pure SQL and have Golang code generated for you, and we've had good experiences using this library in COP and elsewhere.
Depends On
Object Queries
Testing Infrastructure
Sqlc Improvements
pgx/v5/pgtype
to simplify UUID query logic #1378Background
All of policy in the opentdf/platform was built with a tool called squirrel to write PostgreSQL queries programmatically in Go. A new tool called sqlc to write queries directly in SQL and generate the Go code was identified, tested in COP and proven to be useful, and advocated for by larger companies like ngrok at Gophercon.
Unblocks
Rationale
kas-registry
and theGetAttributesByValueFqns
service to service (KAS/authz) API, andresource-mapping-groups
The text was updated successfully, but these errors were encountered: