sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Multiple schemas support

Open victor-mitcov opened this issue 1 year ago • 0 comments

I'm using mysql with the following configuration:

version: "2"
sql:
  - engine: "mysql"
    schema: "some-path/schemas"
    queries: "some-path/queries"
    gen:
      go:
        out: "some-path/tables"
        package: "internal"

I'd like to be able to compile to code queries, which contain cross schema joining. Smth like this: SELECT * from db1.users join db2.posts on db1.users.id = db2.posts.id

Now if I try to prefix table names with the schema name in my schema.sql, I'm getting such errors "schema "db2" does not exist". I'd like to have a way to demonstrate to SQLC which schemas I have and which tables does each of them contain.

What database engines need to be changed?

MySQL

What programming language backends need to be changed?

Go

victor-mitcov avatar May 16 '24 12:05 victor-mitcov