Skip to content

Commit

Permalink
bulker: snowflake: don't load primary keys for empty tables
Browse files Browse the repository at this point in the history
  • Loading branch information
absorbb committed Dec 4, 2024
1 parent eae4800 commit 8b03619
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions bulkerlib/implementations/sql/snowflake.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ func (s *Snowflake) GetTableSchema(ctx context.Context, namespace string, tableN
Statement: query,
})
}

if table.ColumnsCount() == 0 {
return table, nil
}

primaryKeyName, pkFields, err := s.getPrimaryKey(ctx, namespace, tableName)
if err != nil {
Expand Down
15 changes: 11 additions & 4 deletions config-keeper/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ func NewRouter(appContext *Context) *Router {
}
repStatuses[name] = status
}
c.JSON(http.StatusOK, gin.H{
"status": utils.Ternary(healthy, "pass", "fail"),
"repositories": repStatuses,
})
if healthy {
c.JSON(http.StatusOK, gin.H{
"status": "pass",
"repositories": repStatuses,
})
} else {
c.JSON(http.StatusServiceUnavailable, gin.H{
"status": "fail",
"repositories": repStatuses,
})
}
})

return router
Expand Down

0 comments on commit 8b03619

Please sign in to comment.