You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/engine-plugins.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,14 +41,14 @@ No version handshake is required; the proto schema defines the contract.
41
41
version: "2"
42
42
43
43
engines:
44
-
- name: mydb
44
+
- name: external-db
45
45
process:
46
-
cmd: sqlc-engine-mydb
46
+
cmd: sqlc-engine-external-db
47
47
env:
48
-
- MYDB_DSN
48
+
- EXTERNAL_DB_DSN
49
49
50
50
sql:
51
-
- engine: mydb
51
+
- engine: external-db
52
52
schema: "schema.sql"
53
53
queries: "queries.sql"
54
54
codegen:
@@ -73,7 +73,7 @@ For an engine with `process.cmd`, sqlc resolves and runs the plugin as follows:
73
73
1. **Command parsing** — `process.cmd` is split on whitespace. The first token is the executable; any further tokens are passed as arguments, and sqlc appends the RPC method name (`parse`) when invoking the plugin.
74
74
75
75
2. **Executable lookup** — The first token is resolved the same way as in the shell:
76
-
- If it contains a path separator (e.g. `/usr/bin/sqlc-engine-mydb` or `./bin/sqlc-engine-mydb`), it is treated as a path. Absolute paths are used as-is; relative paths are taken relative to the **current working directory of the process running sqlc**.
76
+
- If it contains a path separator (e.g. `/usr/bin/sqlc-engine-external-db` or `./bin/sqlc-engine-external-db`), it is treated as a path. Absolute paths are used as-is; relative paths are taken relative to the **current working directory of the process running sqlc**.
77
77
- If it has no path separator, the executable is looked up in the **PATH** of the process running sqlc. The plugin binary must be on PATH (e.g. after `go install` or adding its directory to PATH) or `process.cmd` must be an absolute path.
78
78
79
79
3. **Working directory** — The plugin process is started with its working directory set to the **directory containing the sqlc config file**. That directory is used for resolving relative paths inside the plugin, not for resolving `process.cmd` itself.
The definition lives in `protos/engine/engine.proto` (generated Go in `pkg/engine`). After editing the proto, run `make proto-engine-plugin` to regenerate the Go code.
@@ -197,7 +197,7 @@ For each `sql[]` block, `sqlc generate` branches on the configured engine: built
197
197
│ 3. Each statement → one codegen query (N helpers) │
0 commit comments