neo4j-contrib / neo4j-etl

Data import from relational databases to Neo4j.
https://neo4j.com/developer/neo4j-etl/
Other
214 stars 46 forks source link

Incorrect schema parameter is passed to org.neo4j.etl.NeoIntegrationCli #72

Open RichardMacaskill opened 4 years ago

RichardMacaskill commented 4 years ago

Using the ETL mapping tool, under Neo4j Desktop v4.0.4, when I click Start Mapping I get a 'Mapping Error' warning.

Looking in the logs, I see the error

and I see the following has been invoked: java -cp "/Users/cas/Library/Application Support/Neo4j Desktop/Application/graphApps/_global/neo4j-etl-ui/dist/neo4j-etl.jar:/Users/cas/Library/Application Support/JetBrains/IntelliJIdea2020.1/jdbc-drivers/SQL Server/7.4.1/mssql-jdbc-7.4.1.jre8.jar" org.neo4j.etl.NeoIntegrationCli generate-metadata-mapping --rdbms:url "jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks" --rdbms:password "MYPASSSWORD" --rdbms:user "sa" --schema "SalesLT" --output-mapping-file "/var/folders/pd/1by7j2s53x5cmk0_f4lbphk80000gn/T/mssql_AdventureWorks_SalesLT_mapping.json"

It looks like the --schema parameter should have been --rdbms:schema. If I make that change, the command completes at the command line as expected.

conker84 commented 4 years ago

Hi @RichardMacaskill we have --rdbms:schema, -s, --schema that are all synonyms. Is it possible that the schema SalesLT that you're looking for is not in the database AdventureWorks? Looking at the schema: https://i0.wp.com/improveandrepeat.com/wp-content/uploads/2018/12/AdvWorksOLTPSchemaVisio.png?ssl=1 you should leverage Sales and not SalesLT Please lemme have your feedback!

RichardMacaskill commented 4 years ago

Thanks @conker84 but I don't think that's the behaviour I'm seeing. MS distribute a lightweight version of AdventureWorks called AdventureWorksLT where the Sales schema is renamed to SalesLT; https://docs.microsoft.com/en-us/sql/samples/adventureworks-install-configure?view=sql-server-ver15&tabs=tsql

image

These are the exact outputs I'm seeing when running 2 commands, which are only differentiated by the --rdbms:schema notation in the latter as opposed to --schema in the former

1.

➜ ~ java -cp "/Users/cas/Library/Application Support/Neo4j Desktop/Application/graphApps/_global/neo4j-etl-ui/dist/neo4j-etl.jar:/Users/cas/Library/Application Support/JetBrains/IntelliJIdea2020.1/jdbc-drivers/SQL Server/7.4.1/mssql-jdbc-7.4.1.jre8.jar" org.neo4j.etl.NeoIntegrationCli generate-metadata-mapping --rdbms:url "jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks" --rdbms:password "PASS" --rdbms:user "sa" --schema "SalesLT" --output-mapping-file "/var/folders/pd/1by7j2s53x5cmk0_f4lbphk80000gn/T/mssql_AdventureWorks_SalesLT_mapping.json"

2.

➜ ~ java -cp "/Users/cas/Library/Application Support/Neo4j Desktop/Application/graphApps/_global/neo4j-etl-ui/dist/neo4j-etl.jar:/Users/cas/Library/Application Support/JetBrains/IntelliJIdea2020.1/jdbc-drivers/SQL Server/7.4.1/mssql-jdbc-7.4.1.jre8.jar" org.neo4j.etl.NeoIntegrationCli generate-metadata-mapping --rdbms:url "jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks" --rdbms:password "PASS" --rdbms:user "sa" —rdbms:schema "SalesLT" --output-mapping-file "/var/folders/pd/1by7j2s53x5cmk0_f4lbphk80000gn/T/mssql_AdventureWorks_SalesLT_mapping.json"

conker84 commented 4 years ago

Can you try by specifying the full schema AdventureWorksLT.SalesLT?

conker84 commented 4 years ago

@RichardMacaskill please look at the comment above^^^

RichardMacaskill commented 4 years ago

Hi @conker84 - AdventureWorksLT.SalesLT wouldn't refer to anything, the database is called AdventureWorks and the schema `SalesLT'.

However I tried the qualified parameter reference AdventureWorks.SalesLT and this completed successfully using both the --rdbms:schema notation AND using the --schema notation.

If I don't qualify the schema name with the database name (as I normally wouldn't when connected to a SQL Server database), it still works with the former and fails with the latter notation, as before.

I guess if the docs and UI were clear that the schema needs to be referenced with the database name, that would be a resolution to this issue.

conker84 commented 4 years ago

@conker84 yes that was the name in my instance :)

We totally need to improve the docs because the full qualified name for the schema is needed only for MSSQL (it's a requirement of a library called SchemaCrawled that we use in order to standardize the DDL extraction from various RDBMS)

Thanks al lot!