Skip to content

Commit a56bc6e

Browse files
authored
:copyfrom support for asyncpg (#87)
* feat: Add support for `speedups` option for type conversion Add new boolean option `speedups` to use other libraries for type conversion. Requires extra dependencies to be installed. Currently affects `sqlite3` & `aiosqlite`. Uses `ciso8601` library. (feature/asyncpg-copyfrom) * feat(asyncpg): add support for COPY FROM query - Added logic to execute COPY FROM query to insert rows into a table with name: methodName CmdCopyFrom and return the number of affected rows. - Updated docstrings to reflect the changes for the new query. - Added parameters and return type information for the new query. (issue #feature/asyncpg-copyfrom) * auto generated code * docs: Update README.md to indicate asyncpg support for copyfrom (issue #feature/asyncpg-copyfrom) * tests * fragment * ci: Add sqlite3 check workflow using nox (feature/asyncpg-copyfrom) * fix some mising sqlite3 tests * readme fix
1 parent 2373c8a commit a56bc6e

43 files changed

Lines changed: 2997 additions & 739 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: Added
2+
body: Added support for `:copyfrom` for driver `asyncpg`
3+
time: 2025-05-21T03:16:52.3803634+02:00
4+
custom:
5+
Author: rayakame
6+
PR: "87"

.coverage

72 KB
Binary file not shown.

.github/workflows/ci.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,26 @@ jobs:
193193
run: |
194194
uv run nox -s aiosqlite_check
195195
196+
sqlite3:
197+
runs-on: ubuntu-latest
198+
name: "Run sqlite3 check via nox"
199+
steps:
200+
- uses: actions/checkout@v4
201+
- name: Install uv
202+
uses: astral-sh/setup-uv@v6
203+
with:
204+
version: "0.6.9"
205+
python-version: "3.13"
206+
207+
- name: Install sqlc
208+
uses: sqlc-dev/setup-sqlc@v4
209+
with:
210+
sqlc-version: '1.28.0'
211+
212+
- name: Run sqlc verify via nox
213+
run: |
214+
uv run nox -s sqlite3_check
215+
196216
test-build:
197217
runs-on: ubuntu-latest
198218

@@ -220,7 +240,7 @@ jobs:
220240
retention-days: 30
221241

222242
ci-done:
223-
needs: [ test,upload-coverage, asyncpg, pyright, ruff, test-build ]
243+
needs: [ test,upload-coverage, asyncpg, aiosqlite, sqlite3, ruff, test-build ]
224244
if: always() && !cancelled()
225245

226246
runs-on: ubuntu-latest

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ More options at the [`sqlc` config reference](https://docs.sqlc.dev/en/stable/re
5252
| `docstrings` | string | no | If set, there will be docstrings generated in the selected format. This can be one of `google`, `numpy`, `pep257` and `none`. `none` will not generate any docstrings. |
5353
| `docstrings_emit_sql` | bool | no | If set to `false` the SQL code for each query wont be included in the docstrings. This defaults to `true` but is not used when `docstrings` is not set or set to `none` |
5454
| `query_parameter_limit` | integer | no | Not yet implemented. |
55+
| `speedups` | bool | no | If set to `true` the plugin will use other librarys for type conversion. Needs extra dependecys to be installed. This option currently only affects `sqlite3` & `aiosqlite` and uses the library `ciso8601` |
5556
| `debug` | bool | no | If set to `true`, there will be debug logs generated into a `log.txt` file when executing `sqlc generate`. Defaults to `false` |
5657

5758
## Feature Support
@@ -61,14 +62,11 @@ The supported [query commands](https://docs.sqlc.dev/en/latest/reference/query-a
6162
6263
> Prepared Queries are not planned for the near future, but will be implemented sooner or later
6364
64-
> [!NOTE]
65-
> Asyncpg only has very bad support until now. It doesn't support `:execresult`, `:execrows` and `:execlastid`
66-
6765
| | `:exec` | `:execresult` | `:execrows` | `:execlastid` | `:many` | `:one` | `:copyfrom` |
6866
|-----------|---------|---------------|-------------|---------------|---------|--------|-------------|
6967
| aiosqlite | yes | yes | yes | yes | yes | yes | no |
7068
| sqlite3 | yes | yes | yes | yes | yes | yes | no |
71-
| asyncpg | yes | no | no | no | yes | yes | no |
69+
| asyncpg | yes | yes | yes | no | yes | yes | yes |
7270
| psycopg2 | no | no | no | no | no | no | no |
7371
| mysql | no | no | no | no | no | no | no |
7472

0 commit comments

Comments
 (0)