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

ER_PARSE_ERROR #21

Open
Darksleep opened this issue Apr 25, 2018 · 2 comments
Open

ER_PARSE_ERROR #21

Darksleep opened this issue Apr 25, 2018 · 2 comments

Comments

@Darksleep
Copy link

Darksleep commented Apr 25, 2018

Hello trying to make mongo keep my mysql up to date but getting bad sql error

root@e69c090f6462:/# momy --config momyfile.json --import
25 Apr 10:04:27 - Connect to MySQL...
25 Apr 10:04:28 - { Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
    at Query.Sequence._packetToError (/usr/lib/node_modules/momy/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)    at Query.ErrorPacket (/usr/lib/node_modules/momy/node_modules/mysql/lib/protocol/sequences/Query.js:77:18)
    at Protocol._parsePacket (/usr/lib/node_modules/momy/node_modules/mysql/lib/protocol/Protocol.js:279:23)
    at Parser.write (/usr/lib/node_modules/momy/node_modules/mysql/lib/protocol/Parser.js:76:12)
    at Protocol.write (/usr/lib/node_modules/momy/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/usr/lib/node_modules/momy/node_modules/mysql/lib/Connection.js:103:28)
    at Socket.emit (events.js:180:13)
    at addChunk (_stream_readable.js:274:12)
    at readableAddChunk (_stream_readable.js:261:11)
    at Socket.Readable.push (_stream_readable.js:218:10)
    --------------------
    at Protocol._enqueue (/usr/lib/node_modules/momy/node_modules/mysql/lib/protocol/Protocol.js:145:48)
    at Connection.query (/usr/lib/node_modules/momy/node_modules/mysql/lib/Connection.js:208:25)
    at Promise (/usr/lib/node_modules/momy/lib/mysql.js:177:10)
    at new Promise (<anonymous>)
    at MySQL.query (/usr/lib/node_modules/momy/lib/mysql.js:175:12)
    at query.then.then (/usr/lib/node_modules/momy/lib/mysql.js:116:24)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
  code: 'ER_PARSE_ERROR',
  errno: 1064,
  sqlMessage: 'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near \')\' at line 1',
  sqlState: '42000',
  index: 1,
  sql: 'DROP TABLE IF EXISTS `t_paste`; CREATE TABLE `t_paste` ();' }
25 Apr 10:04:28 - Bye
root@e69c090f6462:/#

Here my config file

{

  "src": "mongodb://localhost:27017/paste_db",
  "dist": "mysql://root:removed@localhost:3306/mongod",
  "prefix": "t_",
  "case": "camel",
  "collections": {
    "paste": {
      "_id": "_id",
      "TEXT": "db_keywords",
      "TEXT": "emails",
      "TEXT": "hashes",
      "TEXT": "num_emals",
      "TEXT": "num_hashes",
      "VARCHAR": "url"
    }
  }
}

Password been removed to mysql being used and is allowing out of network connections

@cognitom
Copy link
Owner

cognitom commented Apr 25, 2018

@Darksleep try this:

{
  "src": "mongodb://localhost:27017/paste_db",
  "dist": "mysql://root:removed@localhost:3306/mongod",
  "prefix": "t_",
  "case": "camel",
  "collections": {
    "paste": {
      "_id": "string",
      "db_keywords": "TEXT",
      "emails": "TEXT",
      "hashes": "TEXT",
      "num_emals": "TEXT",
      "num_hashes": "TEXT",
      "url": "VARCHAR"
    }
  }
}
  • The definitions in collection were reversed.
  • _id field could be string or number. Adjust it to your environment.

Good luck!

@Darksleep
Copy link
Author

Darksleep commented Apr 25, 2018

@cognitom
If you can close this issue as all been fixed now

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

2 participants