Skip to content

Commit eb640c8

Browse files
authored
fix bug where datatype is read from (#1468)
1 parent ccf980b commit eb640c8

File tree

4 files changed

+42
-94
lines changed

4 files changed

+42
-94
lines changed

internal/codegen/python/gen.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ func makePyType(req *plugin.CodeGenRequest, col *plugin.Column) pyType {
187187
}
188188

189189
func pyInnerType(req *plugin.CodeGenRequest, col *plugin.Column) string {
190+
columnType := sdk.DataType(col.Type)
190191
for _, oride := range req.Settings.Overrides {
191192
if !pyTypeIsSet(oride.PythonType) {
192193
continue
@@ -195,7 +196,7 @@ func pyInnerType(req *plugin.CodeGenRequest, col *plugin.Column) string {
195196
if oride.Column != "" && sdk.MatchString(oride.ColumnName, col.Name) && sameTable {
196197
return pyTypeString(oride.PythonType)
197198
}
198-
if oride.DbType != "" && oride.DbType == col.DataType && oride.Nullable != (col.NotNull || col.IsArray) {
199+
if oride.DbType != "" && oride.DbType == columnType && oride.Nullable != (col.NotNull || col.IsArray) {
199200
return pyTypeString(oride.PythonType)
200201
}
201202
}

internal/plugin/codegen.pb.go

Lines changed: 40 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/plugin/codegen_vtproto.pb.go

Lines changed: 0 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

protos/plugin/codegen.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ message Column
158158
Identifier table = 10;
159159
string table_alias = 11;
160160
Identifier type = 12;
161-
string data_type = 13;
162161
}
163162

164163
message Query

0 commit comments

Comments
 (0)