sqlclojurekorma

Restricting select fields with Korma


I'm trying to restrict the columns returned from a select query to just one column, but Korma seems to just add the additional column to the default ones instead of using just this one:

=> (dry-run (select games (fields :white_id))) dry run :: SELECT "games"."stones", "games"."white_id", "games"."black_id", "games"."white_id" FROM "games" :: []

For reference:

=> (dry-run (select games )) dry run :: SELECT "games"."stones", "games"."white_id", "games"."black_id" FROM "games" :: []

What I'd like to see as the output is:

SELECT "games"."white_id" FROM "games";

Using latest Korma 0.4.0

How can I get that?


Solution

  • I've reported this upstream and it seems to be the expected behaviour (by the Korma developers) for the current version.

    I expect the discussion to continue there instead: https://github.com/korma/Korma/issues/251