Comments (8)
This was introduced by bd676d4.
The query being executed is
SELECT * FROM 'cql_test' WHERE id='foobar'
but the correct query would be
SELECT * FROM cql_test WHERE id='foobar'
Apparently C* 1.1 / CQL3 does not allow quoting of CF-names any more.
from helenus.
I think we should not try to solve this programmatically and just reserve placeholder-replacement to ColumnNames and ColumnValues. This seems to be a common approach with other databases, that use a query-language, like (again) node-mysql.
I'll provide a fix in a minute.
from helenus.
What a stupid bug: I was not defining the timezone explicitly in CQL date-strings which caused the tests to work on my local laptop but made them fail in travis...
Now works all well :).
from helenus.
This issue seems to affect column names too. I.e., it appears that only column value substitution works now using CQL 3.0. (There doesn't appear to be a test that covers this?) I think it would be nice if placeholders continued to work for column names (and even CF names). Maybe auto quoting could be made optional?
from helenus.
Technically, as long as you still go with CQL 2, you can still use placeholders for column names and CF names with helenus.
In CQL 3, however, "dynamic" column names as we know them from CQL 2 don't exist any more, hence quoting these names will result in CQL parse errors (I'm not 100% an expert on this but that's how I understand the intention of CQL 3. Please correct me if I'm wrong!).
Placeholders are meant to provide an easy and safe way to insert user-provided data into a query. Since there are no more "dynamic" column names in CQL 3 which actually could be considered data in CQL 2, I think it would be wrong to allow placeholders for column names (same goes for CF names).
Also CQL 3 now has prepared CQL statements wich may contain placeholders and which are stored serverside (not yet implemented in helenus, but I'm working on it). These prepared statements don't allow placeholders for CF or column names neither. I think any query containing a placeholder that is accepted by helenus should potentially also work as a prepared statement, so allowing un-quoted placeholders in the case where helenus replaces the placeholders will probably cause a lot of unexpected trouble when trying to run the same queries as prepared statements.
from helenus.
Ah, you mentioned that there is not test covering the behavior described above: That's right, we leave it to the developer to write proper queries that work with the target version of CQL since assuring the correct usage of placeholders in the queries would mean that we would have to re-implement the entire CQL-parser within helenus which IMO makes not much sense.
from helenus.
Thanks for your response.
Ok, fair enough. I'm certainly no expert on CQL 3 myself. It seems to me that even if CQL 3 does not allow dynamic column names, the client side library could support placeholders as a programming convenience (i.e, where the specified column name must be one that exists). Of course the client application could implement something itself to support dynamically generated queries with variable column names if so desired. If you feel it's better not to support placeholders for column names because it goes against the intent of CQL 3, I'm ok with that.
Note, however, that you stated in a previous comment, "... and just reserve placeholder-replacement to ColumnNames and ColumnValues", which did lead me to believe the intent was to support placeholders for column names.
Also note that the CQL example on your main page:
pool.cql("SELECT '%s' FROM cf_one WHERE key='%s'", ['col','key123'], function(err, results){
console.log(err, results);
});
is broken for CQL 3. It might be worth adding a comment to that effect, to save some time for people who are trying it out.
from helenus.
@rmechler I admit my previous comment was mis-leading. I wrote it before actually fixing the problem and before I found out, that dynamical column names are no longer supported in CQL 3. Please regard that as obsolete.
And yes, the example in the Readme is definitely CQL 2 syntax and won't work with CQL 3 anymore. On the other hand CQL 3 is still beta and will not become the default before Cassandra 1.2, so I'm not sure whether it's already the right time to re-write the documentation. However a comment would be useful, you're right. See #46
from helenus.
Related Issues (20)
- row.slice() is deserializing data twice giving incorrect values HOT 3
- multi-get thrift support? HOT 2
- formatCQL modifies params HOT 4
- TypeError: value is out of bounds HOT 4
- No way to know when reconnected HOT 4
- Please tag releases of Helenus HOT 3
- HelenusInvalidRequestException: cannot parse '0' as hex bytes HOT 2
- TimeUUIDType seems to be deserialized to a wrong type HOT 1
- Pooling flawed, or improper usage? HOT 12
- CQL3 Map Collection type returning interesting value HOT 8
- ConnectionPool.close should take a callback HOT 1
- TS and TTL returned by row.forEach are incorrect HOT 3
- Problems with timeuuid, CQL3 and INSERT HOT 2
- Adding support for removing multiple columns HOT 7
- Exceptions being thrown when callbacks should suffice — intended? HOT 1
- Connection Pool only using one member HOT 1
- Selecting empty/null collection columns cause "Cannot read property 'length' of null" exceptions HOT 5
- Thrift column family issue. HOT 5
- How to insert an entity containing a collection item, say a set or list? HOT 3
- CQL3 UUID type does not work HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from helenus.