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

Adds destination schema validation to job destinations #3242

Merged
merged 14 commits into from
Feb 11, 2025

Conversation

alishakawaguchi
Copy link
Contributor

@alishakawaguchi alishakawaguchi commented Feb 10, 2025

2025-02-10 12 31 28

@alishakawaguchi alishakawaguchi added the enhancement New feature or request label Feb 10, 2025
@alishakawaguchi alishakawaguchi self-assigned this Feb 10, 2025
Copy link

vercel bot commented Feb 10, 2025

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 Feb 11, 2025 6:01pm

Copy link

github-actions bot commented Feb 10, 2025

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 11, 2025, 6:01 PM

Copy link

codecov bot commented Feb 10, 2025

Codecov Report

Attention: Patch coverage is 49.74093% with 97 lines in your changes missing coverage. Please review.

Project coverage is 23.61%. Comparing base (2dfd71a) to head (7c60014).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
backend/services/mgmt/v1alpha1/job-service/jobs.go 0.00% 67 Missing ⚠️
backend/pkg/integration-test/mux.go 0.00% 21 Missing ⚠️
...kend/services/mgmt/v1alpha1/job-service/service.go 0.00% 8 Missing ⚠️
backend/internal/cmds/mgmt/serve/connect/cmd.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3242      +/-   ##
==========================================
+ Coverage   23.48%   23.61%   +0.13%     
==========================================
  Files         378      379       +1     
  Lines       43489    43656     +167     
==========================================
+ Hits        10215    10311      +96     
- Misses      32229    32300      +71     
  Partials     1045     1045              

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

Copy link

github-actions bot commented Feb 10, 2025

Benchstat Geomean Results

0.18% sec/op, -0.09% B/op, 0.00% allocs/op

Benchstat results
                                   │ main-benchmark.txt │         branch-benchmark.txt          │
                                   │       sec/op       │    sec/op     vs base                 │
CleanPostgresType-4                        41.12n ± ∞ ¹   42.66n ±  5%        ~ (p=0.286 n=1+6)
Runner_Single-4                            7.942µ ± ∞ ¹   7.806µ ±  2%        ~ (p=0.571 n=1+6)
GenerateBool-4                             11.76n ± ∞ ¹   11.34n ±  1%        ~ (p=0.286 n=1+6)
GenerateBusinessName-4                     334.8n ± ∞ ¹   323.2n ± 11%        ~ (p=0.571 n=1+6)
GenerateCardNumber-4                       28.64n ± ∞ ¹   28.58n ±  1%        ~ (p=0.571 n=1+6)
GenerateCategorical-4                      102.3n ± ∞ ¹   102.4n ±  0%        ~ (p=1.143 n=1+6)
GenerateCity-4                             173.1n ± ∞ ¹   178.1n ±  1%        ~ (p=0.286 n=1+6)
GenerateCountry-4                          105.2n ± ∞ ¹   106.2n ±  1%        ~ (p=0.286 n=1+6)
GenerateEmail-4                            1.383µ ± ∞ ¹   1.348µ ±  0%        ~ (p=0.286 n=1+6)
GenerateFirstName-4                        236.7n ± ∞ ¹   204.2n ±  0%  -13.75% (n=1+6)
GenerateFloat64-4                          28.72n ± ∞ ¹   29.25n ±  0%        ~ (p=0.286 n=1+6)
GenerateFullAddress-4                      1.430µ ± ∞ ¹   1.448µ ±  1%        ~ (p=0.286 n=1+6)
GenerateFullName-4                         1.299µ ± ∞ ¹   1.310µ ±  2%        ~ (p=0.857 n=1+6)
GenerateGender-4                           41.98n ± ∞ ¹   41.91n ±  0%        ~ (p=0.286 n=1+6)
GenerateInt64-4                            28.00n ± ∞ ¹   28.01n ±  1%        ~ (p=1.143 n=1+6)
GenerateInt64PhoneNumber-4                 51.76n ± ∞ ¹   57.91n ±  1%        ~ (p=0.286 n=1+6)
GenerateInternationalPhoneNumber-4         176.1n ± ∞ ¹   175.3n ±  0%        ~ (p=0.286 n=1+6)
GenerateIpAddress-4                        568.1n ± ∞ ¹   584.1n ±  1%        ~ (p=0.286 n=1+6)
GenerateLastName-4                         196.7n ± ∞ ¹   195.1n ±  1%        ~ (p=0.571 n=1+6)
GenerateRandomString-4                    1007.0n ± ∞ ¹   990.5n ±  2%        ~ (p=0.286 n=1+6)
GenerateSHA256Hash-4                       1.007µ ± ∞ ¹   1.034µ ±  1%        ~ (p=0.286 n=1+6)
GenerateSSN-4                              301.8n ± ∞ ¹   300.4n ±  1%        ~ (p=0.571 n=1+6)
GenerateState-4                            104.9n ± ∞ ¹   106.7n ±  0%        ~ (p=0.286 n=1+6)
GenerateStreetAddress-4                    205.3n ± ∞ ¹   208.3n ±  0%        ~ (p=0.286 n=1+6)
GenerateStringPhoneNumber-4                173.9n ± ∞ ¹   179.5n ±  1%        ~ (p=0.286 n=1+6)
GenerateUnixTimestamp-4                    81.14n ± ∞ ¹   77.33n ±  1%        ~ (p=0.286 n=1+6)
GenerateUsername-4                         354.3n ± ∞ ¹   358.8n ±  2%        ~ (p=0.857 n=1+6)
GenerateUTCTimestamp-4                     107.1n ± ∞ ¹   104.3n ±  1%        ~ (p=0.286 n=1+6)
GenerateUUID-4                             738.8n ± ∞ ¹   748.6n ±  1%        ~ (p=0.286 n=1+6)
GenerateZipcode-4                          105.5n ± ∞ ¹   105.9n ±  0%        ~ (p=0.286 n=1+6)
TransformCharacterScramble-4               173.7n ± ∞ ¹   173.6n ±  1%        ~ (p=0.857 n=1+6)
TransformE164PhoneNumber-4                 180.9n ± ∞ ¹   184.6n ±  1%        ~ (p=0.286 n=1+6)
TransformEmail-4                           1.791µ ± ∞ ¹   1.813µ ±  0%        ~ (p=0.286 n=1+6)
TransformFirstName-4                       239.7n ± ∞ ¹   236.4n ±  0%   -1.38% (n=1+6)
TransformFloat64-4                         111.5n ± ∞ ¹   110.6n ±  0%        ~ (p=0.286 n=1+6)
TransformFullName-4                        1.304µ ± ∞ ¹   1.279µ ±  1%        ~ (p=0.286 n=1+6)
TransformInt64-4                           33.45n ± ∞ ¹   33.35n ±  1%        ~ (p=0.571 n=1+6)
TransformInt64PhoneNumber-4                58.74n ± ∞ ¹   64.58n ±  0%        ~ (p=0.286 n=1+6)
TransformLastName-4                        197.3n ± ∞ ¹   195.9n ±  0%        ~ (p=0.286 n=1+6)
TransformString-4                          1.026µ ± ∞ ¹   1.019µ ±  3%        ~ (p=0.571 n=1+6)
TransformStringPhoneNumber-4               205.1n ± ∞ ¹   207.6n ±  1%        ~ (p=0.286 n=1+6)
TransformUuid-4                            36.66n ± ∞ ¹   36.58n ±  0%        ~ (p=0.571 n=1+6)
geomean                                    197.0n         197.3n         +0.18%
¹ need >= 6 samples for confidence interval at level 0.95

                                   │ main-benchmark.txt │          branch-benchmark.txt          │
                                   │        B/op        │     B/op      vs base                  │
CleanPostgresType-4                         0.000 ± ∞ ¹     0.000 ± 0%       ~ (p=1.000 n=1+6) ²
Runner_Single-4                           2.318Ki ± ∞ ¹   2.288Ki ± 3%       ~ (p=0.286 n=1+6)
GenerateBool-4                              0.000 ± ∞ ¹     0.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateBusinessName-4                      304.0 ± ∞ ¹     304.0 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateCardNumber-4                        8.000 ± ∞ ¹     8.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateCategorical-4                       64.00 ± ∞ ¹     64.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateCity-4                              160.0 ± ∞ ¹     160.0 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateCountry-4                           24.00 ± ∞ ¹     24.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateEmail-4                             385.0 ± ∞ ¹     385.0 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateFirstName-4                         208.0 ± ∞ ¹     208.0 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateFloat64-4                           8.000 ± ∞ ¹     8.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateFullAddress-4                       512.0 ± ∞ ¹     512.0 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateFullName-4                          418.0 ± ∞ ¹     418.0 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateGender-4                            16.00 ± ∞ ¹     16.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateInt64-4                             7.000 ± ∞ ¹     7.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateInt64PhoneNumber-4                  8.000 ± ∞ ¹     8.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateInternationalPhoneNumber-4          40.00 ± ∞ ¹     40.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateIpAddress-4                         31.00 ± ∞ ¹     31.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateLastName-4                          176.0 ± ∞ ¹     176.0 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateRandomString-4                      186.0 ± ∞ ¹     186.0 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateSHA256Hash-4                        288.0 ± ∞ ¹     288.0 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateSSN-4                               46.00 ± ∞ ¹     46.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateState-4                             24.00 ± ∞ ¹     24.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateStreetAddress-4                     240.0 ± ∞ ¹     240.0 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateStringPhoneNumber-4                 40.00 ± ∞ ¹     40.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateUnixTimestamp-4                     8.000 ± ∞ ¹     8.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateUsername-4                          205.0 ± ∞ ¹     205.0 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateUTCTimestamp-4                      24.00 ± ∞ ¹     24.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateUUID-4                              80.00 ± ∞ ¹     80.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateZipcode-4                           24.00 ± ∞ ¹     24.00 ± 0%       ~ (p=1.000 n=1+6) ²
TransformCharacterScramble-4                40.00 ± ∞ ¹     39.00 ± 3%       ~ (p=1.143 n=1+6)
TransformE164PhoneNumber-4                  40.00 ± ∞ ¹     40.00 ± 0%       ~ (p=1.000 n=1+6) ²
TransformEmail-4                            489.0 ± ∞ ¹     489.0 ± 0%       ~ (p=1.000 n=1+6) ²
TransformFirstName-4                        224.0 ± ∞ ¹     224.0 ± 0%       ~ (p=1.000 n=1+6) ²
TransformFloat64-4                          88.00 ± ∞ ¹     88.00 ± 0%       ~ (p=1.000 n=1+6) ²
TransformFullName-4                         418.0 ± ∞ ¹     418.0 ± 0%       ~ (p=1.000 n=1+6) ²
TransformInt64-4                            8.000 ± ∞ ¹     8.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformInt64PhoneNumber-4                 8.000 ± ∞ ¹     8.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformLastName-4                         176.0 ± ∞ ¹     176.0 ± 0%       ~ (p=1.000 n=1+6) ²
TransformString-4                           202.0 ± ∞ ¹     202.0 ± 0%       ~ (p=1.000 n=1+6) ²
TransformStringPhoneNumber-4                56.00 ± ∞ ¹     56.00 ± 0%       ~ (p=1.000 n=1+6) ²
TransformUuid-4                             16.00 ± ∞ ¹     16.00 ± 0%       ~ (p=1.000 n=1+6) ²
geomean                                               ³                 -0.09%                 ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

                                   │ main-benchmark.txt │         branch-benchmark.txt         │
                                   │     allocs/op      │ allocs/op   vs base                  │
CleanPostgresType-4                         0.000 ± ∞ ¹   0.000 ± 0%       ~ (p=1.000 n=1+6) ²
Runner_Single-4                             24.00 ± ∞ ¹   24.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateBool-4                              0.000 ± ∞ ¹   0.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateBusinessName-4                      2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateCardNumber-4                        1.000 ± ∞ ¹   1.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateCategorical-4                       2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateCity-4                              2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateCountry-4                           2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateEmail-4                             8.000 ± ∞ ¹   8.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateFirstName-4                         2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateFloat64-4                           1.000 ± ∞ ¹   1.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateFullAddress-4                       10.00 ± ∞ ¹   10.00 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateFullName-4                          6.000 ± ∞ ¹   6.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateGender-4                            1.000 ± ∞ ¹   1.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateInt64-4                             0.000 ± ∞ ¹   0.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateInt64PhoneNumber-4                  1.000 ± ∞ ¹   1.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateInternationalPhoneNumber-4          3.000 ± ∞ ¹   3.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateIpAddress-4                         2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateLastName-4                          2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateRandomString-4                      3.000 ± ∞ ¹   3.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateSHA256Hash-4                        7.000 ± ∞ ¹   7.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateSSN-4                               3.000 ± ∞ ¹   3.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateState-4                             2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateStreetAddress-4                     2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateStringPhoneNumber-4                 3.000 ± ∞ ¹   3.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateUnixTimestamp-4                     1.000 ± ∞ ¹   1.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateUsername-4                          6.000 ± ∞ ¹   6.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateUTCTimestamp-4                      1.000 ± ∞ ¹   1.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateUUID-4                              3.000 ± ∞ ¹   3.000 ± 0%       ~ (p=1.000 n=1+6) ²
GenerateZipcode-4                           2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformCharacterScramble-4                2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformE164PhoneNumber-4                  3.000 ± ∞ ¹   3.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformEmail-4                            14.00 ± ∞ ¹   14.00 ± 0%       ~ (p=1.000 n=1+6) ²
TransformFirstName-4                        3.000 ± ∞ ¹   3.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformFloat64-4                          3.000 ± ∞ ¹   3.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformFullName-4                         6.000 ± ∞ ¹   6.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformInt64-4                            1.000 ± ∞ ¹   1.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformInt64PhoneNumber-4                 1.000 ± ∞ ¹   1.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformLastName-4                         2.000 ± ∞ ¹   2.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformString-4                           4.000 ± ∞ ¹   4.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformStringPhoneNumber-4                4.000 ± ∞ ¹   4.000 ± 0%       ~ (p=1.000 n=1+6) ²
TransformUuid-4                             1.000 ± ∞ ¹   1.000 ± 0%       ~ (p=1.000 n=1+6) ²
geomean                                               ³               +0.00%                 ³
¹ need >= 6 samples for confidence interval at level 0.95
² all samples are equal
³ summaries must be >0 to compute geomean

@alishakawaguchi alishakawaguchi requested review from nickzelei and removed request for nickzelei February 10, 2025 22:43
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.

this is great and looks good too.

Can we get at least a basic integration test for this procedure as well?

<Skeleton className="w-full h-24 rounded-lg" />
)}
{!isValidatingSchema && columnErrors && (
<div>
Copy link
Member

Choose a reason for hiding this comment

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

can this be refactored into a component?

!isValidateMappingsLoading &&
tableErrors.length > 0 && (
!isValidatingSchema &&
tableErrors && (
<div>
Copy link
Member

Choose a reason for hiding this comment

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

can this be refactored into a component?

@@ -1665,3 +1723,28 @@ func getJobSourceConnectionId(jobSource *mgmtv1alpha1.JobSource) (*string, error
}
return connectionIdToVerify, nil
}

func getConnectionSchemaConfigByConnectionType(connection *mgmtv1alpha1.Connection) (*mgmtv1alpha1.ConnectionSchemaConfig, error) {
Copy link
Member

Choose a reason for hiding this comment

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

what is the purpose of this function? and why are all of the configs effectively just empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

only the SQL configs are empty. the document storage configs need jobId or jobRunId.
it's needed for the connection data builder GetSchema function.

GetSchema(ctx context.Context, config *mgmtv1alpha1.ConnectionSchemaConfig) ([]*mgmtv1alpha1.DatabaseColumn, error)

MysqlConfig: &mgmtv1alpha1.MysqlSchemaConfig{},
},
}, nil
case *mgmtv1alpha1.ConnectionConfig_DynamodbConfig:
Copy link
Member

Choose a reason for hiding this comment

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

is this supported to be mssql?

@alishakawaguchi alishakawaguchi merged commit 518d360 into main Feb 11, 2025
24 checks passed
@alishakawaguchi alishakawaguchi deleted the alisha/schema-diff branch February 11, 2025 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants