cognitom / cognitom/momy

ER_PARSE_ERROR

Open
#21 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
97
Forks
35
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the generated SQL in the report and inspect the query path in lib/mysql.js, especially the calls at lines 116 and 175-177. Reproduce the import using the provided momyfile.json and trace how the paste collection's fields become the CREATE TABLE statement. Done means the import no longer generates an empty column list or ER_PARSE_ERROR for this configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mariadb, mongodb, mysql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.