Skip to content

Add typed JSON parameter input for d1 query and raw #672

Closed

Description

@irvinebroque

The --params string-array surface cannot express numeric or SQL NULL parameters. Callers must assemble a raw JSON request body.

Version: cf 1.0.0-rc.1; Node 26.12.0; macOS arm64.

Reproduce against a D1 database you can query:

cf d1 query "$DATABASE_ID" \
  --sql 'SELECT typeof(?1) AS n, typeof(?2) AS nil' \
  --params 42.5 null

Flags return {"n":"text","nil":"text"}. Compare:

cf d1 query "$DATABASE_ID" --body \
  '{"sql":"SELECT typeof(?1) AS n, typeof(?2) AS nil","params":[42.5,null]}'

The JSON body preserves real and null.

Requested: a typed JSON parameter option, such as --params-json '[42.5,null]', for query/raw commands. Preserve existing string parameter behavior, including the literal string "null". This is an input capability request; the raw-body workaround works.

Activity

  1. TheVicky1 commented on Nov 18, 2026

    @TheVicky1
    Contributor

    Hey, i would like to work on this issue. Thanks!

  2. petebacondarwin commented on Nov 18, 2026

    @petebacondarwin
    Collaborator

    We need to discuss as a team how this should be supported. I am not sure that postfixing param names with -json is necessarily the correct approach. Moving this feature request to a discussion while we decide what to do.

  3. locked and limited conversation to collaborators on Nov 18, 2026
  4. converted this issue into a discussion #674 on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions