Created
July 5, 2023 01:50
-
-
Save tamsanh/7588f06b22df2c777b48d87ddaa1385d to your computer and use it in GitHub Desktop.
Generate python sql functions with sqlc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
version: "2" | |
plugins: | |
- name: py | |
wasm: | |
url: https://downloads.sqlc.dev/plugin/sqlc-gen-python_1.0.0.wasm | |
sha256: aca83e1f59f8ffdc604774c2f6f9eb321a2b23e07dc83fc12289d25305fa065b | |
sql: | |
- schema: schema.sql # This is the basis for all generated queries | |
queries: ../queries.sql # Queries to generate | |
engine: postgresql # The engine to use | |
codegen: | |
- out: ../sqlc/generated # Output directory | |
plugin: py | |
options: | |
package: generated # Python package name | |
emit_sync_querier: true | |
emit_async_querier: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires sqlc to be installed via brew | |
# With the config.sqlc.yaml, we leverage the python plugin to create a python version of | |
# our queries. | |
sqlc generate -f config.sqlc.yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment