Open praseedasathaye opened 7 years ago
I have the same error with postgres. There's no error when selecting a single table, but there's an error with associations (here: one Student has many Educations).
$ sql2graphql --db mydb -b pg -o example -i
? What is the hostname of your database server? localhost
? What is the database username? root
? What is the database password?
? What is the port number of the undefined database? 5432
? Do you want to use babel + ES6? No
? Do you want a Relay-style GraphQL schema? No
? Select tables to include educations, students
Unhandled rejection error: column "undefined" does not exist
at Connection.parseE (/usr/local/lib/node_modules/sql-to-graphql/node_modules/pg/lib/connection.js:539:11)
at Connection.parseMessage (/usr/local/lib/node_modules/sql-to-graphql/node_modules/pg/lib/connection.js:366:17)
at Socket.<anonymous> (/usr/local/lib/node_modules/sql-to-graphql/node_modules/pg/lib/connection.js:105:22)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at readableAddChunk (_stream_readable.js:178:18)
at Socket.Readable.push (_stream_readable.js:136:10)
at TCP.onread (net.js:563:20)
D/nylon-graphql $ sql2graphql -i
? What kind of database is it? mysql
? What is the hostname of your database server? localhost
? What is the name of the database? nylon
? What is the database username? root
? What is the database password?
? What is the port number of the mysql database? 3306
? Output path of the application ./
? Do you want to use babel + ES6? Yes
? Do you want a Relay-style GraphQL schema? No
? Select tables to include admin_users, article_images, author_socials, authors, categories, categories_hashtags, credits, featured_images, galleries, gallery_images, hashtags, images, pages, posts, posts_tags, records, redirectsUnhandled rejection TypeError: Cannot read property 'originalName' of undefined
at generateListReferenceField (/Users/daniel/.config/yarn/global/node_modules/sql-to-graphql/steps/generate-types.js:154:105)
at /Users/daniel/.config/yarn/global/node_modules/sql-to-graphql/steps/generate-types.js:59:25
at Array.forEach (<anonymous>)
at generateType (/Users/daniel/.config/yarn/global/node_modules/sql-to-graphql/steps/generate-types.js:58:30)
at Object.generateTypes (/Users/daniel/.config/yarn/global/node_modules/sql-to-graphql/steps/generate-types.js:32:27)
at /Users/daniel/.config/yarn/global/node_modules/sql-to-graphql/cli.js:144:28
at /Users/daniel/.config/yarn/global/node_modules/async/lib/async.js:726:13
at /Users/daniel/.config/yarn/global/node_modules/async/lib/async.js:52:16
at done (/Users/daniel/.config/yarn/global/node_modules/async/lib/async.js:246:17)
at /Users/daniel/.config/yarn/global/node_modules/async/lib/async.js:44:16
at /Users/daniel/.config/yarn/global/node_modules/async/lib/async.js:723:17
at /Users/daniel/.config/yarn/global/node_modules/async/lib/async.js:167:37
at /Users/daniel/.config/yarn/global/node_modules/sql-to-graphql/node_modules/lodash/function/after.js:43:19
at /Users/daniel/.config/yarn/global/node_modules/sql-to-graphql/steps/find-one-to-many-rels.js:35:24
at /Users/daniel/.config/yarn/global/node_modules/sql-to-graphql/backends/mysql.js:89:21
at tryCatcher (/Users/daniel/.config/yarn/global/node_modules/knex/node_modules/bluebird/js/main/util.js:26:23)
^C⏎
I have a table called blogs in the database blogPost that has below information
mysql> desc blogs; +-------------+------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------+------------------+------+-----+---------+----------------+ | id | int(10) unsigned | NO | PRI | NULL | auto_increment | | userId | int(11) | NO | | NULL | | | title | varchar(150) | NO | | NULL | | | description | varchar(150) | NO | | NULL | | +-------------+------------------+------+-----+---------+----------------+
sqlToGraphql$ sql2graphql -i ? What kind of database is it? mysql ? What is the hostname of your database server? localhost ? What is the name of the database? blogPost ? What is the database username? root ? What is the database password? **** ? What is the port number of the mysql database? 3306 ? Output path of the application /Users/Projects/sqlToGraphql ? Do you want to use babel + ES6? No ? Do you want a Relay-style GraphQL schema? No ? Select tables to include blogs, users Unhandled rejection Error: ER_BAD_FIELD_ERROR: Unknown column 'undefined' in 'field list' at Query.Sequence._packetToError (/usr/local/lib/node_modules/sql-to-graphql/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14) at Query.ErrorPacket (/usr/local/lib/node_modules/sql-to-graphql/node_modules/mysql/lib/protocol/sequences/Query.js:77:18) at Protocol._parsePacket (/usr/local/lib/node_modules/sql-to-graphql/node_modules/mysql/lib/protocol/Protocol.js:280:23) at Parser.write (/usr/local/lib/node_modules/sql-to-graphql/node_modules/mysql/lib/protocol/Parser.js:75:12) at Protocol.write (/usr/local/lib/node_modules/sql-to-graphql/node_modules/mysql/lib/protocol/Protocol.js:39:16) at Socket. (/usr/local/lib/node_modules/sql-to-graphql/node_modules/mysql/lib/Connection.js:103:28)
at emitOne (events.js:96:13)
at Socket.emit (events.js:189:7)
at readableAddChunk (_stream_readable.js:176:18)
at Socket.Readable.push (_stream_readable.js:134:10)
at TCP.onread (net.js:551:20)