Open
Description
Version
1.28.0
What happened?
I'm using this sqlite3
command to export schema from the database: sqlite3 db/data.db '.schema authors' > ./db/schema.sql
and it generates an sql schema where all table and column names are surrounded with a backtick character. This schema cannot be parsed by sqlc
. Removing the backtick characters using command sed -i "s/\`//g" db/schema.sql
allows sqlc to generate the code.
Relevant log output
# package db
db/query.sql:6:1: relation "authors" does not exist
Database schema
CREATE TABLE `authors` (
`id` INTEGER PRIMARY KEY,
`name` text NOT NULL,
`bio` text
);
SQL queries
-- name: GetAuthor :one
SELECT * FROM authors WHERE id = ? LIMIT 1;
Configuration
version: "2"
sql:
- engine: "sqlite"
queries: "db/query.sql"
schema: "db/schema.sql"
gen:
go:
package: "db"
out: "db"
Playground URL
https://play.sqlc.dev/p/5d35e2538160c53e61fe204c3a2f05fe489687ac10a8d74304a82c2d7ec95871
What operating system are you using?
Linux
What database engines are you using?
SQLite
What type of code are you generating?
Go