Skip to content

How to access a dynamic table?  #2823

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?

Activity

  1. changed the title [-]How to access a dynamic db? [/-] [+]How to access a dynamic table/db? [/+] on Oct 11, 2023
  2. changed the title [-]How to access a dynamic table/db? [/-] [+]How to access a dynamic table? [/+] on Oct 11, 2023
  3. locked and limited conversation to collaborators on Oct 11, 2023
  4. converted this issue into a discussion #2830 on Oct 11, 2023
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