Page MenuHomeDevCentral

Don't require PostgreSQL schema at build time
ClosedPublic

Authored by dereckson on Jan 18 2023, 20:24.
Tags
None
Referenced Files
F2742632: D2749.id6985.diff
Thu, Mar 28, 06:08
F2739637: D2749.id6985.diff
Wed, Mar 27, 16:18
F2739294: D2749.id6981.diff
Wed, Mar 27, 14:16
Unknown Object (File)
Wed, Mar 27, 09:15
Unknown Object (File)
Tue, Mar 26, 16:24
Unknown Object (File)
Sat, Mar 23, 02:38
Unknown Object (File)
Fri, Mar 22, 18:32
Unknown Object (File)
Fri, Mar 22, 11:20
Subscribers
None

Details

Summary

The sqlx crate offers macros like sqlx::query_as! to validate
the query at build time and infer from the table column the return type.

If it's convenient, it requires a PostgreSQL view (or table) fantoir
to exists when building fantoir-datasource. This is a chichen egg issue,
as the tool is intended to prepare the schema too with -c flags.

This change switches from sqlx::query_as! to sqlx_query_as
and sqlx_query_scalar, without his requirement.

Note we lost the validation against SQL schema by the sqlx macros
as a trade-off.

Ref T1750.

Test Plan

Call the service from CLI:

  • fantoir-datasource query chaos
  • `fantoir-datasource query --code-insee 77246 --code-voie B015

Diff Detail

Repository
rDS Nasqueron Datasources
Lint
No Lint Coverage
Unit
No Test Coverage
Branch
remove-sqlx-macros
Build Status
Buildable 4354
Build 4621: arc lint + arc unit

Event Timeline

dereckson created this revision.
dereckson retitled this revision from Improve query service not to require pgsql at build time to Don't require PostgreSQL schema at build time.Jan 18 2023, 20:25
dereckson edited the test plan for this revision. (Show Details)
dereckson added a reviewer: dereckson.
dereckson edited the test plan for this revision. (Show Details)

Simplify

This revision is now accepted and ready to land.Jan 18 2023, 23:21