Closed torukMnk closed 6 years ago
It's not finished, I'm testing find & count methods, but I'm getting a DriverError
Bus.find({}).exec(console.log)
sails> { AdapterError: Malformed error from adapter: Should always be an Error instance, but instead, got:
{ Error: line 1:97 no viable alternative at input 'LIMIT' (..."state","path" FROM bus WHERE [LIMIT]...)
at ResponseError.DriverError (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/errors.js:14:19)
at new ResponseError (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/errors.js:51:24)
at FrameReader.readError (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/readers.js:317:13)
at Parser.parseBody (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:194:66)
at Parser._transform (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:137:10)
at Parser.Transform._read (_stream_transform.js:190:10)
at Parser.Transform._write (_stream_transform.js:178:12)
at doWrite (_stream_writable.js:371:12)
at writeOrBuffer (_stream_writable.js:357:5)
at Parser.Writable.write (_stream_writable.js:274:11)
at Protocol.ondata (_stream_readable.js:626:20)
at emitOne (events.js:115:13)
at Protocol.emit (events.js:210:7)
at addChunk (_stream_readable.js:250:12)
at readableAddChunk (_stream_readable.js:237:11)
at Protocol.Readable.push (_stream_readable.js:195:10)
at Protocol.Transform.push (_stream_transform.js:151:32)
at Protocol.readItems (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:109:10)
at Protocol._transform (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:32:10)
at Protocol.Transform._read (_stream_transform.js:190:10)
at Protocol.Transform._write (_stream_transform.js:178:12)
at doWrite (_stream_writable.js:371:12)
name: 'ResponseError',
stack: 'Error: line 1:97 no viable alternative at input \'LIMIT\' (..."state","path" FROM bus WHERE [LIMIT]...)\n at ResponseError.DriverError (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_module
s/cassandra-driver/lib/errors.js:14:19)\n at new ResponseError (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/errors.js:51:24)\n at FrameReader.readError (/Users/tango
.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/readers.js:317:13)\n at Parser.parseBody (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cass
andra-driver/lib/streams.js:194:66)\n at Parser._transform (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:137:10)\n at Parser.Transform._read (_stream_trans
form.js:190:10)\n at Parser.Transform._write (_stream_transform.js:178:12)\n at doWrite (_stream_writable.js:371:12)\n at writeOrBuffer (_stream_writable.js:357:5)\n at Parser.Writable.write (_stream_writable.js:274:11)\n a
t Protocol.ondata (_stream_readable.js:626:20)\n at emitOne (events.js:115:13)\n at Protocol.emit (events.js:210:7)\n at addChunk (_stream_readable.js:250:12)\n at readableAddChunk (_stream_readable.js:237:11)\n at Protocol
.Readable.push (_stream_readable.js:195:10)\n at Protocol.Transform.push (_stream_transform.js:151:32)\n at Protocol.readItems (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driv
er/lib/streams.js:109:10)\n at Protocol._transform (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:32:10)\n at Protocol.Transform._read (_stream_transform.js
:190:10)\n at Protocol.Transform._write (_stream_transform.js:178:12)\n at doWrite (_stream_writable.js:371:12)',
message: 'line 1:97 no viable alternative at input \'LIMIT\' (..."state","path" FROM bus WHERE [LIMIT]...)',
info: 'Represents an error message from the server',
code: 8192,
coordinator: '127.0.0.1:9042',
query: 'SELECT "createdAt","updatedAt","id","city_id","bus","cost","city","state","path" FROM bus WHERE LIMIT 9007199254740991 ALLOW FILTERING;' }
Bus.count().exec(console.log)
sails> { AdapterError: Malformed error from adapter: Should always be an Error instance, but instead, got:
{ Error: line 1:32 no viable alternative at input 'ALLOW' (...(*) FROM bus WHERE [ALLOW]...)
at ResponseError.DriverError (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/errors.js:14:19)
at new ResponseError (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/errors.js:51:24)
at FrameReader.readError (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/readers.js:317:13)
at Parser.parseBody (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:194:66)
at Parser._transform (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:137:10)
at Parser.Transform._read (_stream_transform.js:190:10)
at Parser.Transform._write (_stream_transform.js:178:12)
at doWrite (_stream_writable.js:371:12)
at writeOrBuffer (_stream_writable.js:357:5)
at Parser.Writable.write (_stream_writable.js:274:11)
at Protocol.ondata (_stream_readable.js:626:20)
at emitOne (events.js:115:13)
at Protocol.emit (events.js:210:7)
at addChunk (_stream_readable.js:250:12)
at readableAddChunk (_stream_readable.js:237:11)
at Protocol.Readable.push (_stream_readable.js:195:10)
at Protocol.Transform.push (_stream_transform.js:151:32)
at Protocol.readItems (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:109:10)
at Protocol._transform (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:32:10)
at Protocol.Transform._read (_stream_transform.js:190:10)
at Protocol.Transform._write (_stream_transform.js:178:12)
at doWrite (_stream_writable.js:371:12)
at writeOrBuffer (_stream_writable.js:357:5)
name: 'ResponseError',
stack: 'Error: line 1:32 no viable alternative at input \'ALLOW\' (...(*) FROM bus WHERE [ALLOW]...)\n at ResponseError.DriverError (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra
-driver/lib/errors.js:14:19)\n at new ResponseError (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/errors.js:51:24)\n at FrameReader.readError (/Users/tango.io/project
s/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/readers.js:317:13)\n at Parser.parseBody (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-drive
r/lib/streams.js:194:66)\n at Parser._transform (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:137:10)\n at Parser.Transform._read (_stream_transform.js:190
:10)\n at Parser.Transform._write (_stream_transform.js:178:12)\n at doWrite (_stream_writable.js:371:12)\n at writeOrBuffer (_stream_writable.js:357:5)\n at Parser.Writable.write (_stream_writable.js:274:11)\n at Protocol.
ondata (_stream_readable.js:626:20)\n at emitOne (events.js:115:13)\n at Protocol.emit (events.js:210:7)\n at addChunk (_stream_readable.js:250:12)\n at readableAddChunk (_stream_readable.js:237:11)\n at Protocol.Readable.p
ush (_stream_readable.js:195:10)\n at Protocol.Transform.push (_stream_transform.js:151:32)\n at Protocol.readItems (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/stre
ams.js:109:10)\n at Protocol._transform (/Users/tango.io/projects/expressjs/test-project/node_modules/sails-cassandra/node_modules/cassandra-driver/lib/streams.js:32:10)\n at Protocol.Transform._read (_stream_transform.js:190:10)\n
at Protocol.Transform._write (_stream_transform.js:178:12)\n at doWrite (_stream_writable.js:371:12)\n at writeOrBuffer (_stream_writable.js:357:5)',
message: 'line 1:32 no viable alternative at input \'ALLOW\' (...(*) FROM bus WHERE [ALLOW]...)',
info: 'Represents an error message from the server',
code: 8192,
coordinator: '127.0.0.1:9042',
query: 'SELECT COUNT(*) FROM bus WHERE ALLOW FILTERING;' }
User.find({}).exec(console.log)
sails> undefined [ { createdAt: 1523751439511,
updatedAt: 1523751439511,
id: 1,
emailAddress: 'admin@example.com',
password: '$2a$10$Hj88zHWTJ6Z.AKIbmjfMk.aJieRD0rngS1X.yitaOPd8HSsBS..2K',
fullName: 'Ryan Dahl',
isSuperAdmin: true,
passwordResetToken: '',
passwordResetTokenExpiresAt: 0,
stripeCustomerId: '',
hasBillingCard: false,
billingCardBrand: '',
billingCardLast4: '',
billingCardExpMonth: '',
billingCardExpYear: '',
emailProofToken: '',
emailProofTokenExpiresAt: 0,
emailStatus: 'confirmed',
emailChangeCandidate: '',
tosAcceptedByIp: '',
lastSeenAt: 0 },
Default datastore is working.
It seems now is about cassandra-driver, hope we can fix this, let me know what do you think.
Yes, I see that. There are two problems that I see so far - 1. they changed the API and 2. they changed their integration for stricter compliance, but cassandra is not atypical SQL database, so some types of queries simply not possible. I will try to downgrade the required API version but I'm shooting in the dark here - there is no documentation for this and I don't know what are valid values for API version. I'm going to try few more things.
Right, I'm running the query that the error shows up directly into cqlsh 5.0.1.
SELECT "createdAt","updatedAt","id","city_id","bus","cost","city","state","path" FROM bus WHERE LIMIT 9007199254740991 ALLOW FILTERING;
1st Error "WHERE" empty
SyntaxException: <ErrorMessage code=2000 [Syntax error in CQL query] message="line 1:97 no viable alternative at input 'LIMIT' (..."state","path" FROM bus WHERE [LIMIT]...)">
2nd Error "LIMIT 9007199254740991"
InvalidRequest: code=2200 [Invalid query] message="unable to make int from '9007199254740991'"
Remove "WHERE" & "LIMIT" OR set "LIMIT" to a valid int
SELECT "createdAt","updatedAt","id","city_id","bus","cost","city","state","path" FROM bus ALLOW FILTERING;
Waterline options , current params:
{ method: 'find',
using: 'bus',
criteria:
{ where: {},
limit: 9007199254740991,
skip: 0,
sort: [],
select:
[ 'createdAt',
'updatedAt',
'id',
'city_id',
'bus',
'cost',
'city',
'state',
'path' ] },
meta: undefined,
joins: [] }
So maybe we need to custom it to our needs since waterline options attach params that breaks the query.
I reverted your pull requests. It seems breaks backward compatibility. I set adapterApiVersion
to 0
instead as it seems that it will require more work to make it v1 compatible and there is no oficial documentation yet. I will give it another shot once I have more info.
Roger that!
Upgrading adapter methods & parameters to sailsjs v1.0 compatibility