Skip to content

Commit 7130e10

Browse files
authored
codegen: Remove built-in Python support (#1936)
1 parent 44df94b commit 7130e10

File tree

25 files changed

+360
-7354
lines changed

25 files changed

+360
-7354
lines changed

Makefile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mysqlsh:
4545
# libprotoc 3.19.1
4646
# $ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
4747
# $ go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@latest
48-
proto: internal/plugin/codegen.pb.go internal/python/ast/ast.pb.go
48+
proto: internal/plugin/codegen.pb.go
4949

5050
internal/plugin/codegen.pb.go: protos/plugin/codegen.proto
5151
protoc -I ./protos \
@@ -54,9 +54,3 @@ internal/plugin/codegen.pb.go: protos/plugin/codegen.proto
5454
--go-vtproto_out=. \
5555
--go-vtproto_opt=module=github.com/kyleconroy/sqlc,features=marshal+unmarshal+size \
5656
./protos/plugin/codegen.proto
57-
58-
internal/python/ast/ast.pb.go: protos/python/ast.proto
59-
protoc -I ./protos \
60-
--go_out=. \
61-
--go_opt=module=github.com/kyleconroy/sqlc \
62-
./protos/python/ast.proto

internal/cmd/generate.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
"github.com/kyleconroy/sqlc/internal/codegen/golang"
1515
"github.com/kyleconroy/sqlc/internal/codegen/json"
16-
"github.com/kyleconroy/sqlc/internal/codegen/python"
1716
"github.com/kyleconroy/sqlc/internal/compiler"
1817
"github.com/kyleconroy/sqlc/internal/config"
1918
"github.com/kyleconroy/sqlc/internal/config/convert"
@@ -141,12 +140,6 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer
141140
Gen: config.SQLGen{Go: sql.Gen.Go},
142141
})
143142
}
144-
if sql.Gen.Python != nil {
145-
pairs = append(pairs, outPair{
146-
SQL: sql,
147-
Gen: config.SQLGen{Python: sql.Gen.Python},
148-
})
149-
}
150143
if sql.Gen.JSON != nil {
151144
pairs = append(pairs, outPair{
152145
SQL: sql,
@@ -190,10 +183,6 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer
190183
name = combo.Go.Package
191184
lang = "golang"
192185

193-
case sql.Gen.Python != nil:
194-
lang = "python"
195-
name = combo.Python.Package
196-
197186
case sql.Plugin != nil:
198187
lang = fmt.Sprintf("process:%s", sql.Plugin.Plugin)
199188
name = sql.Plugin.Plugin
@@ -290,10 +279,6 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re
290279
out = combo.Go.Out
291280
handler = ext.HandleFunc(golang.Generate)
292281

293-
case sql.Gen.Python != nil:
294-
out = combo.Python.Out
295-
handler = ext.HandleFunc(python.Generate)
296-
297282
case sql.Gen.JSON != nil:
298283
out = combo.JSON.Out
299284
handler = ext.HandleFunc(json.Generate)

internal/cmd/shim.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ func pluginOverride(o config.Override) *plugin.Override {
4040
Column: o.Column,
4141
ColumnName: column,
4242
Table: &table,
43-
PythonType: pluginPythonType(o.PythonType),
4443
GoType: pluginGoType(o),
4544
}
4645
}
@@ -58,7 +57,6 @@ func pluginSettings(cs config.CombinedSettings) *plugin.Settings {
5857
Overrides: over,
5958
Rename: cs.Rename,
6059
Codegen: pluginCodegen(cs.Codegen),
61-
Python: pluginPythonCode(cs.Python),
6260
Go: pluginGoCode(cs.Go),
6361
Json: pluginJSONCode(cs.JSON),
6462
}
@@ -76,19 +74,6 @@ func pluginCodegen(s config.Codegen) *plugin.Codegen {
7674
}
7775
}
7876

79-
func pluginPythonCode(s config.SQLPython) *plugin.PythonCode {
80-
return &plugin.PythonCode{
81-
Out: s.Out,
82-
Package: s.Package,
83-
EmitExactTableNames: s.EmitExactTableNames,
84-
EmitSyncQuerier: s.EmitSyncQuerier,
85-
EmitAsyncQuerier: s.EmitAsyncQuerier,
86-
EmitPydanticModels: s.EmitPydanticModels,
87-
QueryParameterLimit: s.QueryParameterLimit,
88-
InflectionExcludeTableNames: s.InflectionExcludeTableNames,
89-
}
90-
}
91-
9277
func pluginGoCode(s config.SQLGo) *plugin.GoCode {
9378
return &plugin.GoCode{
9479
EmitInterface: s.EmitInterface,
@@ -129,13 +114,6 @@ func pluginGoType(o config.Override) *plugin.ParsedGoType {
129114
}
130115
}
131116

132-
func pluginPythonType(pt config.PythonType) *plugin.PythonType {
133-
return &plugin.PythonType{
134-
Module: pt.Module,
135-
Name: pt.Name,
136-
}
137-
}
138-
139117
func pluginJSONCode(s config.SQLJSON) *plugin.JSONCode {
140118
return &plugin.JSONCode{
141119
Out: s.Out,

0 commit comments

Comments
 (0)