Skip to content

Feature/neo4j - Feature request - Add Support for Neo4j as a source DB | 01 - Base Spanner Tables - #1263

Open
yogeshtewari wants to merge 13 commits into
GoogleCloudPlatform:masterfrom
yogeshtewari:feature/neo4j
Open

yogeshtewari wants to merge 13 commits into
GoogleCloudPlatform:masterfrom
yogeshtewari:feature/neo4j

Conversation

@yogeshtewari

@yogeshtewari yogeshtewari commented Jan 17, 2026 •

Copy link
Copy Markdown

Fixes #1262

It's a good idea to open an issue first for discussion.

  • Tests pass
  • Appropriate changes to README are included in PR
@yogeshtewari
yogeshtewari requested a review from a team as a code owner January 17, 2026 04:50
@yogeshtewari
yogeshtewari requested review from aasthabharill and darshan-sj and removed request for a team January 17, 2026 04:50
@codecov

codecov Bot commented Jan 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.56051% with 105 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.40%. Comparing base (e2cae84) to head (9d16fd3).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
sources/neo4j/infoschema.go 63.72% 36 Missing and 1 partial ⚠️
sources/common/toddl.go 0.00% 18 Missing and 1 partial ⚠️
webv2/api/schema.go 0.00% 18 Missing ⚠️
conversion/conversion_from_source.go 12.50% 14 Missing ⚠️
spanner/ddl/neo4j_graph.go 91.42% 3 Missing and 3 partials ⚠️
conversion/get_info.go 0.00% 5 Missing ⚠️
profiles/source_profile.go 82.60% 3 Missing and 1 partial ⚠️
sources/neo4j/toddl.go 85.71% 2 Missing ⚠️
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     
Components Coverage Δ
backend-apis 46.38% <67.85%> (+0.28%) ⬆️
backend-library 57.00% <65.61%> (+0.15%) ⬆️
cli 26.65% <ø> (ø)
frontend 39.37% <100.00%> (+0.03%) ⬆️
Files with missing lines Coverage Δ
conversion/conversion.go 41.42% <100.00%> (ø)
spanner/ddl/ast.go 91.42% <100.00%> (+0.56%) ⬆️
ui/src/app/app.constants.ts 100.00% <100.00%> (ø)
...s/direct-connection/direct-connection.component.ts 38.66% <100.00%> (+0.82%) ⬆️
.../components/load-session/load-session.component.ts 28.57% <ø> (ø)
...s/prepare-migration/prepare-migration.component.ts 24.84% <100.00%> (ø)
webv2/helpers/helpers.go 17.39% <100.00%> (ø)
webv2/web.go 24.73% <100.00%> (+4.37%) ⬆️
sources/neo4j/toddl.go 85.71% <85.71%> (ø)
profiles/source_profile.go 89.91% <82.60%> (-0.54%) ⬇️
... and 6 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rohitwali rohitwali left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@rohitwali
rohitwali requested review from shreyakhajanchi and removed request for aasthabharill January 19, 2026 07:13
Comment thread conversion/conversion_from_source.go Resolved
yogeshtewari and others added 4 commits July 14, 2026 14:38
- 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
Yogesh Tewari added 7 commits July 14, 2026 18:39
- 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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need another type here ?

"github.com/neo4j/neo4j-go-driver/v6/neo4j"
)

const GraphNodeTableName = "GraphNode"

Copy link
Copy Markdown
Contributor

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 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},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same question as above.

}{
{"id", "STRING", false},
{"label", "STRING", false},
{"properties", "JSON", false},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems like a single foreign key is being added here, for edges to refer to nodes.

What happens when there are different labels ?

Comment thread sources/neo4j/toddl.go
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":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it might be better to create a struct here - as there are so many values being returned.

Comment thread webv2/web.go
sessionState.DbName,
sourceDBConnectionDetails.DataCenter)
} else if sessionState.Driver == constants.NEO4J {
sourceProfileString = fmt.Sprintf("\"uri=bolt://%v:%v\",\"user=%v\",\"password=%v\"",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i think for secure schema this will also need bolt+ or so

@bharadwaj-aditya

Copy link
Copy Markdown
Contributor

Please rebase the changes from the mainline.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3 participants