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

NEOS-1438 Destination option to skip foreign key constraint errors in sync #2665

Merged
merged 6 commits into from
Sep 11, 2024

Conversation

alishakawaguchi
Copy link
Contributor

No description provided.

@alishakawaguchi alishakawaguchi added the Feature Created by Linear-GitHub Sync label Sep 11, 2024
@alishakawaguchi alishakawaguchi self-assigned this Sep 11, 2024
Copy link

linear bot commented Sep 11, 2024

Copy link

vercel bot commented Sep 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
neosync-docs ⬜️ Ignored (Inspect) Visit Preview Sep 11, 2024 8:28pm

@alishakawaguchi alishakawaguchi changed the title NEOS-1438 Destination options to skip foreign key constraint errors in sync NEOS-1438 Destination option to skip foreign key constraint errors in sync Sep 11, 2024
Copy link

github-actions bot commented Sep 11, 2024

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedSep 11, 2024, 8:28 PM

Copy link

codecov bot commented Sep 11, 2024

Codecov Report

Attention: Patch coverage is 34.18803% with 77 lines in your changes missing coverage. Please review.

Project coverage is 36.58%. Comparing base (aa405fe) to head (7fb07b6).
Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
...ws/datasync/activities/gen-benthos-configs/sync.go 0.00% 26 Missing ⚠️
worker/pkg/benthos/sql/output_sql_insert.go 41.86% 24 Missing and 1 partial ⚠️
backend/sql/postgresql/models/models.go 36.84% 12 Missing ⚠️
worker/pkg/benthos/utils.go 0.00% 9 Missing ⚠️
worker/pkg/benthos/sql/output_sql_update.go 72.22% 4 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2665      +/-   ##
==========================================
+ Coverage   36.48%   36.58%   +0.09%     
==========================================
  Files         272      273       +1     
  Lines       25271    25441     +170     
==========================================
+ Hits         9221     9307      +86     
- Misses      14795    14872      +77     
- Partials     1255     1262       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@nickzelei nickzelei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, left a minor comment about a follow up we should do.

errorCount := 0
insertCount := 0
for _, row := range rows {
insertQuery, err := querybuilder.BuildInsertQuery(s.driver, fmt.Sprintf("%s.%s", s.schema, s.table), columns, [][]any{row}, &s.onConflictDoNothing)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fmt.Sprintf("%s.%s", s.schema, s.table)
I know this gets fed into goqu and properly escaped, but what if the schema or table has a period in it? I'm guessing it doesnt know what to do. Anyways, idk if we are doing this anywhere but now that I'm hyper aware of special chars thought i'd point this out...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in a follow up we should update those BuildInsertQuery and BuildUpdateQuery functions to call out schema and table as specific parameters so that we can use goqu to build them like goqu.T(table).Schema(schema) so that it can handle the escaping for us.

@alishakawaguchi alishakawaguchi merged commit e81dc7d into main Sep 11, 2024
18 of 20 checks passed
@alishakawaguchi alishakawaguchi deleted the alisha/neos-1438-skip-fk-error branch September 11, 2024 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Created by Linear-GitHub Sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants