Skip to content

How to access a dynamic table?  #2823

@wingerse

Description

@wingerse

I have a bunch of sharded tables with name of the format: table_001, table_002, ... table_999.
The correct table is accessed by key % 1000.

So a query might look as follows:

select * from table_%03s where key=?

Before executing the query I format it with fmt.Sprintf(query, key).

Is there a way to do this in sqlc?

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