Repository navigation
Feature/neo4j - Feature request - Add Support for Neo4j as a source DB | 01 - Base Spanner Tables - #1263
Feature/neo4j - Feature request - Add Support for Neo4j as a source DB | 01 - Base Spanner Tables#1263yogeshtewari wants to merge 13 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1263 +/- ##
==========================================
+ Coverage 51.19% 51.40% +0.20%
==========================================
Files 202 205 +3
Lines 22796 23097 +301
Branches 552 553 +1
==========================================
+ Hits 11671 11872 +201
- Misses 10437 10532 +95
- Partials 688 693 +5
🚀 New features to boost your workflow:
|
rohitwali
left a comment
There was a problem hiding this comment.
Thanks for the changes. This is definitely a much needed feature for our customers.
Can you?
1/ Add links to any design docs, etc if there are any upcoming PRs on schema migration support?
2/ Add a section on testing done.
- Add constants.NEO4J to DataConv routing in conversion.go - Register constants.NEO4J case in GetInfoSchema to return neo4j.InfoSchemaImpl - Resolve build failures in sources/neo4j/infoschema.go by removing obsolete interface methods - Add test case to TestDataConv in conversion_test.go Ref: GoogleCloudPlatform#1262
- Change GraphNode.label type to STRING(MAX) to prevent Spanner DYNAMIC LABEL array type conflicts - Update TestNeo4jInfoSchema unit test assertions Ref: GoogleCloudPlatform#1262
- Call getNeo4jGraphDDL dynamically inside GetDDL under spanner/ddl/ast.go - Create spanner/ddl/neo4j_graph.go to encapsulate table/column name resolution and graph statement assembly - Implement spanner/ddl/neo4j_graph_test.go to test name resolution helper functions and DDL formatting - Add TestGetDDL_Neo4jPropertyGraph to ast_test.go Ref: GoogleCloudPlatform#1262
- Set ParentTable of GraphEdge to GraphNode with ON DELETE CASCADE inside SchemaToSpannerDDL - Remove the redundant foreign key from GraphEdge that was mapped from the source database - Add TestSchemaToSpannerDDL_Neo4jInterleaving unit test to sources/neo4j/toddl_test.go Ref: GoogleCloudPlatform#1262
- Register constants.NEO4J connection handler in webv2/web.go - Implement validateNeo4jConnection using bolt protocol and neo4j-go-driver - Add case constants.NEO4J in ConvertSchemaSQL under webv2/api/schema.go - Implement TestDatabaseConnectionNeo4j unit tests in webv2/web_test.go Ref: GoogleCloudPlatform#1262
- Add Neo4j to SourceDbNames enum in app.constants.ts - Register Neo4j engine in direct-connection component and load-session component - Restrict dialect to Google Standard SQL and hide PostgreSQL dialect for Neo4j source - Set migration mode to schemaOnly for Neo4j database type in prepare-migration component - Add unit tests for Neo4j engine form validation and migration mode settings Ref: GoogleCloudPlatform#1262
- Map constants.NEO4J to return itself in GetSourceDatabaseFromDriver - Add unit test case for Neo4j driver in helpers_test.go - Resolve prepare migration unsupported driver error popup Ref: GoogleCloudPlatform#1262
…in getSourceAndTargetProfiles - Add constants.NEO4J case in getSourceAndTargetProfiles to build the 'uri=bolt://...' parameter string - Implement TestGetSourceAndTargetProfiles_Neo4j unit tests Ref: GoogleCloudPlatform#1262
…ion success message - Replace fmt.Println inside conversion/conversion_from_source.go with logger.Log.Info to follow codebase logging conventions Ref: GoogleCloudPlatform#1262
- Update the overview section to explicitly list Cassandra and Neo4j as supported source engines Ref: GoogleCloudPlatform#1262
| if err != nil { | ||
| return conv, err | ||
| } | ||
| case profiles.SourceProfileTypeConnection: |
There was a problem hiding this comment.
Why do we need another type here ?
| "github.com/neo4j/neo4j-go-driver/v6/neo4j" | ||
| ) | ||
|
|
||
| const GraphNodeTableName = "GraphNode" |
There was a problem hiding this comment.
What is the purpose of this constant ? Is the assumption here that tables will be always names Graphnode ?
| // GetTables returns the fixed tables for Schema-less migration: GraphNode and GraphEdge. | ||
| func (isi InfoSchemaImpl) GetTables() ([]common.SchemaAndName, error) { | ||
| return []common.SchemaAndName{ | ||
| {Name: GraphNodeTableName}, |
There was a problem hiding this comment.
same question as above.
| }{ | ||
| {"id", "STRING", false}, | ||
| {"label", "STRING", false}, | ||
| {"properties", "JSON", false}, |
There was a problem hiding this comment.
Does properties always map to a JSON ? In Spanner will this unwrap into columns or continue to be a json blob ?
| // Let's return nothing here and handle Interleave in ProcessTable or manually ?? | ||
| // Actually, standard logic uses these FKs to allow user to choose Interleave. | ||
| // Let's return a synthetic FK. | ||
| fkId := internal.GenerateForeignkeyId() |
There was a problem hiding this comment.
It seems like a single foreign key is being added here, for edges to refer to nodes.
What happens when there are different labels ?
| func (tdi ToDdlImpl) ToSpannerType(conv *internal.Conv, spType string, srcType schema.Type, isPk bool) (ddl.Type, []internal.SchemaIssue) { | ||
| var ty ddl.Type | ||
| switch srcType.Name { | ||
| case "STRING": |
There was a problem hiding this comment.
AFAIK Neo4j also supports numeric types. How will that get handled ?
| return CreateTable{}, CreateTable{}, false | ||
| } | ||
|
|
||
| func getNeo4jGraphColumns(nodeTable CreateTable, edgeTable CreateTable) (nodeIdCol, nodeLabelCol, nodePropsCol, edgeSrcCol, edgeDestCol, edgeLabelCol, edgePropsCol string, ok bool) { |
There was a problem hiding this comment.
it might be better to create a struct here - as there are so many values being returned.
| sessionState.DbName, | ||
| sourceDBConnectionDetails.DataCenter) | ||
| } else if sessionState.Driver == constants.NEO4J { | ||
| sourceProfileString = fmt.Sprintf("\"uri=bolt://%v:%v\",\"user=%v\",\"password=%v\"", |
There was a problem hiding this comment.
i think for secure schema this will also need bolt+ or so
|
Please rebase the changes from the mainline. |
Fixes #1262