-
Notifications
You must be signed in to change notification settings - Fork 360
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
Improve dbt errors #2895
Improve dbt errors #2895
Conversation
pkg/metastore/ms_client.go
Outdated
} | ||
return copyDBWithTransformLocation(ctx, fromClient, toClient, fromDB, toDB, transformLocation) | ||
} | ||
|
||
func copyDBWithTransformLocation(ctx context.Context, fromClient, toClient Client, fromDB string, toDB string, transformLocation func(location string) (string, error)) error { | ||
schema, err := fromClient.GetDatabase(ctx, fromDB) | ||
if err != nil { | ||
return err | ||
return fmt.Errorf("failed to get database on copy: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would add the fromDB to the error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pkg/metastore/ms_client.go
Outdated
return toClient.CreateDatabase(ctx, schema) | ||
err = toClient.CreateDatabase(ctx, schema) | ||
if err != nil { | ||
return fmt.Errorf("failed to create database with name %s and location %s :%w", schema.Name, schema.LocationURI, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- fix the spaces
- prefer to use '%s' to quote names/values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pkg/metastore/ms_client.go
Outdated
return ReplaceBranchName(location, toBranch) | ||
transformedLocation, err := ReplaceBranchName(location, toBranch) | ||
if err != nil { | ||
return "", fmt.Errorf("failed to replace branch name with location: %s and branch: %s : %w", location, toBranch, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional:
return "", fmt.Errorf("failed to replace branch name with location: %s and branch: %s : %w", location, toBranch, err) | |
return "", fmt.Errorf("failed to replace branch name with location '%s' and branch '%s': %w", location, toBranch, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
pkg/metastore/ms_client.go
Outdated
return ReplaceBranchName(location, toBranch) | ||
transformedLocation, err := ReplaceBranchName(location, toBranch) | ||
if err != nil { | ||
return "", fmt.Errorf("failed to replace branch name with location: %s and branch: %s : %w", location, toBranch, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return "", fmt.Errorf("failed to replace branch name with location: %s and branch: %s : %w", location, toBranch, err) | |
return "", fmt.Errorf("failed to replace branch name with location '%s' and branch '%s': %w", location, toBranch, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
cmd/lakectl/cmd/dbt.go
Outdated
@@ -168,7 +169,7 @@ func dbtDebug(projectRoot string) string { | |||
dbtCmd.Dir = projectRoot | |||
output, err := dbtCmd.Output() | |||
if err != nil { | |||
DieErr(err) | |||
DieFmt("failed to run dbt debug with output:\n %s\n and error: %s", output, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DieFmt("failed to run dbt debug with output:\n %s\n and error: %s", output, err) | |
DieFmt("Failed to run dbt debug with output:\n%s\nError: %s", output, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
cmd/lakectl/cmd/dbt.go
Outdated
@@ -146,7 +147,7 @@ func getDbtTables(projectRoot string) ([]model, error) { | |||
dbtCmd.Dir = projectRoot | |||
output, err := dbtCmd.Output() | |||
if err != nil { | |||
return nil, err | |||
return nil, fmt.Errorf("failed to run dbt debug with output:\n %s\n and error: %s", output, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about this one - it looks like an error that goes to the output not something that failed - it capture the output.
is that right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason, when dbt debug returns an error, the information for the error is printed to the standard outpout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it, now, in case of error: the output is first printed as output and the error as error
c6506e6
to
82def39
Compare
82def39
to
daddbfb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.