I’ve some basic questions about N1QL.
- The bucket name is case sensitive.
cbq> select deptno,loc,dname from hr where type=‘dept2’ limit 1;
–> “msg”: “Keyspace not found keyspace hr - cause: No bucket named hr”
And select deptno,loc,dname from HR, work fine.
The bucket was created in Uppercase.
Any way to avoid this sensitive?
- The caracters used in a where must be enclose using single quota o double quota.
select deptno,loc,dname from HR where type=‘dept2’ limit 1;
generate a request id:
select deptno,loc,dname from HR where type**=“dept2”** limit 1;
Generate another request ID.
Any implication to use single o doublé quota?
How can I display other metrics at N1QL level like: sortCount, mutationCount, errorCount , etc?
When you use attributes alias like, select deptno as XXXX, ename as Nombre , the attributes order output Is ordered alphabetically and the write order is changed.
Is posible to avoid this behavior?
yes all identifiers are case sensitive and there’s no way to avoid the behaviour.
This is to avoid conflicts: you can have buckets multiple buckets named “hr” but with different combinations of casing (e.g. “Hr” and “hr”). If N1QL ignored casing it wouldn’t be able to differentiate between the two buckets above.
Same argument goes for JSON field names.
single and double quotes are mostly interchangeable. Double quoting allows some escaping that single quoting does not.
if you are interested in obtaining metrics at the N1QL level, starting from 4.5 we have a couple of system keyspaces that list current and past requests: system:active_requests and system:completed_requests.
If you select from either of them you can access the metrics above for request that are running or requests that have completed.
Projection list field sorting cannot be turned off - it’s there because since N1QL uses flexible schema, it is much easier to see if fields are missing in individual result documents if the fields are sorted alphabetically.
Also note that fields can be accessed case-insensistively, using back ticks and the letter i.
WHERE hr.`TYPE`i = …
Thanks for your answers this help me!
Thanks Gerald for the additional help.