HomeDevCentral

Don't require PostgreSQL schema at build time

Description

Don't require PostgreSQL schema at build time

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

Reviewers: dereckson

Reviewed By: dereckson

Maniphest Tasks: T1750

Differential Revision: https://devcentral.nasqueron.org/D2749

Details

Provenance
derecksonAuthored on Jan 18 2023, 23:21
derecksonPushed on Jan 18 2023, 23:22
Reviewer
dereckson
Differential Revision
D2749: Don't require PostgreSQL schema at build time
Parents
rDS8a1106d6c142: Improve quey service documentation header
Branches
Unknown
Tags
Unknown
Tasks
T1750: Import FANTOIR database