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

DATETIME values return a string with mysql and export using cypher:batch #98

Open
vga91 opened this issue Aug 19, 2024 · 0 comments
Open

Comments

@vga91
Copy link

vga91 commented Aug 19, 2024

Create a docker-compose.yml

version: '3.8'

services:
  mysql:
    hostname: mysql
    image: mysql:8.0.31
    volumes:
      - ./mysql-dump:/docker-entrypoint-initdb.d
    networks:
      - my_network
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: northwind
      MYSQL_USER: myuser
      MYSQL_PASSWORD: mypassword
    cap_add:
      - SYS_NICE
    ports:
      - "3306:3306"

And a mysql-dump/northwind.sql file:

CREATE DATABASE IF NOT EXISTS northwind;
USE northwind;

CREATE TABLE `Employees` (
    `EmployeeID` INTEGER NOT NULL AUTO_INCREMENT,
    `BirthDate` DATETIME,
    CONSTRAINT `PK_Employees` PRIMARY KEY (`EmployeeID`)
);

TRUNCATE TABLE Employees;
INSERT INTO Employees VALUES(null,'1948-12-08');

And execute docker-compose up -d.

Then we can execute:

./bin/neo4j-etl generate-metadata-mapping --rdbms:url "jdbc:mysql://localhost:3306/northwind?allowPublicKeyRetrieval=true&autoReconnect=true&useSSL=false" --rdbms:user root --rdbms:password rootpassword --rdbms:schema northwind --output-mapping-file /tmp/mapping.json --csv-directory /tmp/northwind

and finally:

./bin/neo4j-etl export \
 --rdbms:url "jdbc:mysql://localhost:3306/northwind?autoReconnect=true&useSSL=false" \
 --rdbms:user root --rdbms:password rootpassword \
 --rdbms:schema northwind --using cypher:batch \
 --csv-directory /tmp/northwind --mapping-file /tmp/mapping.json --neo4j:url "bolt://server2:7687" --neo4j:user neo4j --neo4j:password "mypassword" --debug --unwindBatchSize 1000 --txBatchSize 1000 --quote '"' --force

By executing MATCH (n:Employee) RETURN valueType(n.birthDate),
we can see that the property BirthDate is returned as a string, instead of a LOCAL DATETIME

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant