Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codegen: Remove built-in Python support #1936

Merged
merged 1 commit into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ mysqlsh:
# libprotoc 3.19.1
# $ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
# $ go install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@latest
proto: internal/plugin/codegen.pb.go internal/python/ast/ast.pb.go
proto: internal/plugin/codegen.pb.go

internal/plugin/codegen.pb.go: protos/plugin/codegen.proto
protoc -I ./protos \
Expand All @@ -54,9 +54,3 @@ internal/plugin/codegen.pb.go: protos/plugin/codegen.proto
--go-vtproto_out=. \
--go-vtproto_opt=module=github.com/kyleconroy/sqlc,features=marshal+unmarshal+size \
./protos/plugin/codegen.proto

internal/python/ast/ast.pb.go: protos/python/ast.proto
protoc -I ./protos \
--go_out=. \
--go_opt=module=github.com/kyleconroy/sqlc \
./protos/python/ast.proto
15 changes: 0 additions & 15 deletions internal/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

"github.com/kyleconroy/sqlc/internal/codegen/golang"
"github.com/kyleconroy/sqlc/internal/codegen/json"
"github.com/kyleconroy/sqlc/internal/codegen/python"
"github.com/kyleconroy/sqlc/internal/compiler"
"github.com/kyleconroy/sqlc/internal/config"
"github.com/kyleconroy/sqlc/internal/config/convert"
Expand Down Expand Up @@ -141,12 +140,6 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer
Gen: config.SQLGen{Go: sql.Gen.Go},
})
}
if sql.Gen.Python != nil {
pairs = append(pairs, outPair{
SQL: sql,
Gen: config.SQLGen{Python: sql.Gen.Python},
})
}
if sql.Gen.JSON != nil {
pairs = append(pairs, outPair{
SQL: sql,
Expand Down Expand Up @@ -190,10 +183,6 @@ func Generate(ctx context.Context, e Env, dir, filename string, stderr io.Writer
name = combo.Go.Package
lang = "golang"

case sql.Gen.Python != nil:
lang = "python"
name = combo.Python.Package

case sql.Plugin != nil:
lang = fmt.Sprintf("process:%s", sql.Plugin.Plugin)
name = sql.Plugin.Plugin
Expand Down Expand Up @@ -290,10 +279,6 @@ func codegen(ctx context.Context, combo config.CombinedSettings, sql outPair, re
out = combo.Go.Out
handler = ext.HandleFunc(golang.Generate)

case sql.Gen.Python != nil:
out = combo.Python.Out
handler = ext.HandleFunc(python.Generate)

case sql.Gen.JSON != nil:
out = combo.JSON.Out
handler = ext.HandleFunc(json.Generate)
Expand Down
22 changes: 0 additions & 22 deletions internal/cmd/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func pluginOverride(o config.Override) *plugin.Override {
Column: o.Column,
ColumnName: column,
Table: &table,
PythonType: pluginPythonType(o.PythonType),
GoType: pluginGoType(o),
}
}
Expand All @@ -58,7 +57,6 @@ func pluginSettings(cs config.CombinedSettings) *plugin.Settings {
Overrides: over,
Rename: cs.Rename,
Codegen: pluginCodegen(cs.Codegen),
Python: pluginPythonCode(cs.Python),
Go: pluginGoCode(cs.Go),
Json: pluginJSONCode(cs.JSON),
}
Expand All @@ -76,19 +74,6 @@ func pluginCodegen(s config.Codegen) *plugin.Codegen {
}
}

func pluginPythonCode(s config.SQLPython) *plugin.PythonCode {
return &plugin.PythonCode{
Out: s.Out,
Package: s.Package,
EmitExactTableNames: s.EmitExactTableNames,
EmitSyncQuerier: s.EmitSyncQuerier,
EmitAsyncQuerier: s.EmitAsyncQuerier,
EmitPydanticModels: s.EmitPydanticModels,
QueryParameterLimit: s.QueryParameterLimit,
InflectionExcludeTableNames: s.InflectionExcludeTableNames,
}
}

func pluginGoCode(s config.SQLGo) *plugin.GoCode {
return &plugin.GoCode{
EmitInterface: s.EmitInterface,
Expand Down Expand Up @@ -129,13 +114,6 @@ func pluginGoType(o config.Override) *plugin.ParsedGoType {
}
}

func pluginPythonType(pt config.PythonType) *plugin.PythonType {
return &plugin.PythonType{
Module: pt.Module,
Name: pt.Name,
}
}

func pluginJSONCode(s config.SQLJSON) *plugin.JSONCode {
return &plugin.JSONCode{
Out: s.Out,
Expand Down
Loading