Skip to content

Commit

Permalink
Fixing issues related to update
Browse files Browse the repository at this point in the history
  • Loading branch information
kellrott authored and matthewpeterkort committed Dec 19, 2024
1 parent 4091ab0 commit 44b45f4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
3 changes: 2 additions & 1 deletion extractors/sqldump_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ func (ml *SQLDumpStep) Start(task task.RuntimeTask) (chan map[string]interface{}
case *sqlparser.Insert:
//fmt.Printf("Inserting into: %s\n", stmt.Table.Name)

tableName := stmt.Table.Name.CompliantName()
t, _ := stmt.Table.TableName()

Check failure on line 90 in extractors/sqldump_step.go

View workflow job for this annotation

GitHub Actions / build

stmt.Table.TableName undefined (type sqlparser.TableName has no field or method TableName)

Check failure on line 90 in extractors/sqldump_step.go

View workflow job for this annotation

GitHub Actions / lint

stmt.Table.TableName undefined (type sqlparser.TableName has no field or method TableName) (typecheck)

Check failure on line 90 in extractors/sqldump_step.go

View workflow job for this annotation

GitHub Actions / lint

stmt.Table.TableName undefined (type sqlparser.TableName has no field or method TableName)) (typecheck)
tableName := t.Name.CompliantName()

if _, ok := tables[tableName]; ok || len(tables) == 0 {
cols := tableColumns[tableName]
Expand Down
19 changes: 15 additions & 4 deletions transform/graph_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ type graphBuildProcess struct {
sch graph.GraphSchema
class string

edgeFix evaluate.Processor
edgeFix evaluate.Processor
objectCount int
vertexCount int
edgeCount int
}

func (ts GraphBuildStep) Init(task task.RuntimeTask) (Processor, error) {
Expand Down Expand Up @@ -60,7 +63,7 @@ func (ts GraphBuildStep) Init(task task.RuntimeTask) (Processor, error) {
edgeFix = c
}
}
return &graphBuildProcess{ts, task, sc, ts.Title, edgeFix}, nil
return &graphBuildProcess{ts, task, sc, ts.Title, edgeFix, 0, 0, 0}, nil
}

func (ts GraphBuildStep) GetConfigFields() []config.Variable {
Expand All @@ -77,15 +80,22 @@ func (ts *graphBuildProcess) PoolReady() bool {
return true
}

func (ts *graphBuildProcess) Close() {}
func (ts *graphBuildProcess) Close() {
logger.Info("Graph Emit",
"objects", ts.objectCount,
"edges", ts.edgeCount,
"vertices", ts.vertexCount,
"class", ts.class)
}

func (ts *graphBuildProcess) Process(i map[string]interface{}) []map[string]interface{} {

out := []map[string]any{}

if o, err := ts.sch.Generate(ts.class, i, ts.config.Clean, map[string]any{}); err == nil {
ts.objectCount++
for _, j := range o {

Check failure on line 96 in transform/graph_build.go

View workflow job for this annotation

GitHub Actions / lint

copylocks: range var j copies lock: github.com/bmeg/grip/gripql.GraphElement contains google.golang.org/protobuf/internal/impl.MessageState contains sync.Mutex (govet)
if j.Vertex != nil {
ts.vertexCount++
err := ts.task.Emit("vertex", ts.vertexToMap(j.Vertex), false)
if err != nil {
logger.Error("Emit Error: %s", err)
Expand All @@ -101,6 +111,7 @@ func (ts *graphBuildProcess) Process(i map[string]interface{}) []map[string]inte
edgeData = o
}
}
ts.edgeCount++
err := ts.task.Emit("edge", edgeData, false)
if err != nil {
logger.Error("Emit Error: %s", err)
Expand Down

0 comments on commit 44b45f4

Please sign in to comment.