Skip to content

Commit 440baa6

Browse files
Merge pull request #4 from enveritas/Escape-Technologies-main
Invalid name generation when using python reserved keywords
2 parents 6cdbccb + e1e3865 commit 440baa6

File tree

61 files changed

+431
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+431
-297
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
go-version: '1.23.5'
1616
- uses: sqlc-dev/setup-sqlc@v4
1717
with:
18-
sqlc-version: '1.28.0'
18+
sqlc-version: '1.29.0'
1919
- run: make
2020
- run: make test
2121
- run: sqlc diff

README.md

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -76,47 +76,3 @@ class Status(str, enum.Enum):
7676
OPEN = "op!en"
7777
CLOSED = "clo@sed"
7878
```
79-
80-
### Override Column Types
81-
82-
Option: `overrides`
83-
84-
You can override the SQL to Python type mapping for specific columns using the `overrides` option. This is useful for columns with JSON data or other custom types.
85-
86-
Example configuration:
87-
88-
```yaml
89-
options:
90-
package: authors
91-
emit_pydantic_models: true
92-
overrides:
93-
- column: "some_table.payload"
94-
py_import: "my_lib.models"
95-
py_type: "Payload"
96-
```
97-
98-
This will:
99-
1. Override the column `payload` in `some_table` to use the type `Payload`
100-
2. Add an import for `my_lib.models` to the models file
101-
102-
Example output:
103-
104-
```python
105-
# Code generated by sqlc. DO NOT EDIT.
106-
# versions:
107-
# sqlc v1.28.0
108-
109-
import datetime
110-
import pydantic
111-
from typing import Any
112-
113-
import my_lib.models
114-
115-
116-
class SomeTable(pydantic.BaseModel):
117-
id: int
118-
created_at: datetime.datetime
119-
payload: my_lib.models.Payload
120-
```
121-
122-
This is similar to the [overrides functionality in the Go version of sqlc](https://docs.sqlc.dev/en/stable/howto/overrides.html#overriding-types).

examples/src/authors/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.29.0
44
import dataclasses
55
from typing import Optional
66

examples/src/authors/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.29.0
44
# source: query.sql
55
from typing import AsyncIterator, Iterator, Optional
66

examples/src/booktest/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.29.0
44
import dataclasses
55
import datetime
66
import enum

examples/src/booktest/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.29.0
44
# source: query.sql
55
import dataclasses
66
import datetime

examples/src/jets/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.29.0
44
import dataclasses
55

66

examples/src/jets/query-building.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.29.0
44
# source: query-building.sql
55
from typing import AsyncIterator, Optional
66

examples/src/ondeck/city.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.29.0
44
# source: city.sql
55
from typing import AsyncIterator, Optional
66

examples/src/ondeck/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Code generated by sqlc. DO NOT EDIT.
22
# versions:
3-
# sqlc v1.28.0
3+
# sqlc v1.29.0
44
import dataclasses
55
import datetime
66
import enum

0 commit comments

Comments
 (0)