-
Notifications
You must be signed in to change notification settings - Fork 986
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
Spanner Import/Export INTERLEAVE IN #2128
base: main
Are you sure you want to change the base?
Conversation
…ite/read the type to/from avro. No change to tests yet.
…oDdlConverter. Also properly default to IN PARENT when emitting ddl, in case the interleave type is not set (really only necessary for tests, since otherwise it will always be set.
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.
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.
Please check If there are Unit tests or Integration tests for the files being modified in this PR. If there are can you add test cases for INTERLEAVE IN ?
v1/src/main/java/com/google/cloud/teleport/spanner/DdlToAvroSchemaConverter.java
Show resolved
Hide resolved
v1/src/main/java/com/google/cloud/teleport/spanner/ddl/InformationSchemaScanner.java
Show resolved
Hide resolved
v1/src/main/java/com/google/cloud/teleport/spanner/ddl/InformationSchemaScanner.java
Show resolved
Hide resolved
v1/src/main/java/com/google/cloud/teleport/spanner/ddl/InformationSchemaScanner.java
Outdated
Show resolved
Hide resolved
v1/src/main/java/com/google/cloud/teleport/spanner/ddl/InformationSchemaScanner.java
Outdated
Show resolved
Hide resolved
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.
Please add tests.
Please test Export + import for a PG database with your feature.
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.
Please add a test case in ExportPipelineIT
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2128 +/- ##
============================================
+ Coverage 46.88% 46.90% +0.01%
- Complexity 4011 4018 +7
============================================
Files 874 874
Lines 52042 52054 +12
Branches 5454 5459 +5
============================================
+ Hits 24398 24414 +16
+ Misses 25902 25901 -1
+ Partials 1742 1739 -3
|
Add support for Import/Export of Spanner
INTERLEAVE IN
tables. This new feature allows for omitting thePARENT
keyword inCREATE/ALTER <table> INTERLEAVE IN [PARENT] <parent_table>
clauses.INTERLEAVE IN
tables are similar toINTERLEAVE IN PARENT
, but do not enforce parent/child referential integrity.INTERLEAVE IN
tables do not supportON DELETE
actions.I manually verified this works by creating a table with two children, one
INTERLEAVE IN
and the otherINTERLEAVE IN PARENT
. All tables had a few rows - and theINTERLEAVE IN
table contained a row for which the parent row was missing.I exported this db to avro using these instructuons, and imported to an empty db following these. I manually checked the target db contained the correct tables and rows, and also verified the entries in the
INFORMATION_SCHEMA.Tables
were identical across both tables (specifically theINTERLEAVE_TYPE
,PARENT_TABLE_NAME
, andON_DELETE_ACTION
columns)