sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Field order changed in sqlc v1.27 breaking sqlc-gen-python

Open kevinvalk opened this issue 1 year ago • 2 comments

Version

1.27.0

What happened?

In Python the generated code requires to be ordered in a certain way (fields with defaults at the end). This was taken care by the following code in the sqlc-gen-python plugin

https://github.com/sqlc-dev/sqlc-gen-python/blob/3d5cd342d23ae143ed892170ffecda20ff9a1958/internal/gen.go#L1088-L1091

Between version 1.26.0 and 1.27.0, something was changed that broke that sorting. Now, fields are not ordered correctly anymore and in the case of Python, the generated files will break Python.

kevinvalk avatar Aug 11 '24 12:08 kevinvalk

Do you have a specific example that worked in 1.26.0 and fails in 1.27.0? It would help to have an exact case to understand what broke.

kyleconroy avatar Aug 12 '24 01:08 kyleconroy

Do you have a specific example that worked in 1.26.0 and fails in 1.27.0? It would help to have an exact case to understand what broke.

Will create a minimal example (probably early next week...).

kevinvalk avatar Aug 12 '24 07:08 kevinvalk