I was reading the documentation for SQLC from https://docs.sqlc.dev/en/latest/howto/query_count.html. I wanted to use this in my project. However, I'm not seeing any documentation related to joining operations on the tables. Is it really possible in SQLC. If yes where I could find the documentation or reference?
A commit like "cdf7025: Add MySQL json test" (or "456fcb1 Add MySQL test for SELECT * JOIN") suggests joins are supported.
But it is true, as mentioned in issue 643, that queries with JOINs are for now not documented yet.
Related
I'm using Official Aerospike Package for golang.
Is there any way to get list of all existing indexes this like?
aql> show indexes
Also I haven't found any way to execute pure aql query.
How can I do this?
Update:
I'm looking for something similar to this but for aerospike (example from Rails)
custom_query = "select * from users"
result = ActiveRecord::Base.connection.execute(custom_query)
aql>show indexes
is a valid aql command and should show you all the secondary indexes you currently have on the server.
aql runs the C api underneath. You can do pretty much everything with aql at a rudimnetary level.
Type: aql>help it will throw all the aql commands at you, cut and paste!
aql also stores command history in a text file - so persists over sessions.
aql>run 'filepath/filename' is a handy way to store all aql commands in a text file and run them.
Re: aql query -- look at: select * from ns. where ... you can do equality and range queries provided you have pre-built the secondary indexes.
Aerospike ver 3.12+ introduced predicate filtering - ie ~complex queries - I don't think aql has been updated to run those yet.
HTH.
AQL is an admin and data browsing tool. It's not really Aerospike's SQL, as Aerospike doesn't natively implement a query language. Instead, all the Aerospike clients give you an API to make direct get, put, scan, query calls, and those are procedural, not declarative like SQL (where you state how you want the result and the server figures out a query plan). Piyush mentioned the predicate filtering API which is fantastic and lets you create complex queries over scans and secondary-index queries.
Specifically to your question about getting all the indexes, that's the type of thing you should use the info command for. Aerospike allows you to get and set config parameters through it, and get a wide range of metrics, run microbenchmark, etc. Everything you need for admin and monitoring.
You can run sindex through the standalone asinfo tool, or you can call it using the info command that any client provides.
asinfo -v "sindex"
When I put an alias into a ,(case when a.X then a.Y end ) AS XY Modifying the a. doesn't work at all. I am running 12.6 for toad. Does anyone know how to get the dropdown to populate always? Thanks
It won't populate always. You've encountered a shortcoming that has been discussed ad nauseam on the official Toad forums if you care to search there for detailed explanation.
Toad's Code Insight uses its parser to digest your SQL and extract from it table references, etc. If the parser cannot make sense of your code then it cannot detect table references. When using Code Insight, SQL is often times incomplete since you are actively working on constructing it. The parser can overcome a lot of hurdles with respect to incomplete code, but not all of them. Your example is one of the common examples where the parser cannot overcome your incomplete CASE statement to locate the table references in your FROM clause.
This problem has been documented and logged extensively in the bug tracker as part of a larger syntax recovery feature of the parser. There are no estimates on when it will be resolved.
I'm instantiating a client-side representation of an Oracle Schema data-model in custom Table/Column/Constraint/Index data structures, in C/C++ using OCI. For this, I'm selecting from:
all_tables
all_tab_comments
all_col_comments
all_cons_columns
all_constraints
etc...
And then I'm using OCI to describe all tables, for precise information about column types. This is working, but our CI testing farm is often failing inside this schema data-model introspection code, because another test is running in parallel and creating/deleting tables in the middle of this serie of queries and describe calls I'm making.
My question is thus how can I introspect this schema atomically such that another session does not concurrently change that very schema I'm instropecting?
Would using a Read-only Serializable transaction around the selects and describes be enough? I.e. does MVCC apply to Oracle's data dictionaries? What would be the likelihood of SnapShot too Old errors on such system dictionaries?
If full atomicity is not possible, are there steps I could take to minimize the possibility of getting inconsistent / stale info?
I was thinking maybe left-joins to reduce the number of queries, and/or replacing the OCIDescribeAny() calls with other dictionary accesses joined to other tables, to get all table/column info in a single query each?
I'd appreciate some expert input on this concurrency issue. Thanks, --DD
a typical read-write conflict. from the top of my head i see 2 ways around it:
use dbms_lock package in both "introspection" and "another test".
rewrite your retrospection query so that it returns one big thing of what you need. there are multiple ways to do that:
use xmlagg and alike.
use listagg and get one big string or clob.
just use a bunch of unions to get one resultset, as it's guaranteed to be consistent.
hope that helps.
I would like to query a list of values from the database, then use it as input for my custom C++ UDF.
The idea being that I'd grab the mapping from the database when the query started. This is the part I don't know how to do from within C++.
SELECT 'foo',val ...
Then the return value of my custom_scalar_func, I could map the similar names and derive my new value.
SELECT custom_scalar_func(some_other_val,'foo') ...
Heard back from their support, Vertica does not support being able to run queries from within a UDx.
A mandatory requirement is to have Vertica SDK.
Also, it is highly recommneded you will have the Vertica documentation,
especially Programmer's Guide and SDK doumnetation.
Both of them can be downloaded from here (after registration):
https://my.vertica.com
Additional great source would be the Vertica contributed packages located in github here:
Vertica github home page
I found great example of SUDF (Scalar User Defined Function) in here:
Vertica Scalar word count function
According to the Vertica documentation:
"You create your UDSF by subclassing two classes defined by the Vertica SDK: Vertica::ScalarFunction and Vertica::ScalarFunctionFactory."
This is the basic, I think after you look at the link above (wordcount), you will understand how it works.
One of my larger applications is using NHibernate over an Oracle data store. For testing/development, the application uses NHibernate's schema generation to create/re-create the database when needed. Prior to delivery, one of the things being asked of us by the DBAs is to include Comments for each field in the database (there are a lot). I'm looking for solutions that would let me specify the comment in the mapping file. Has anyone done anything like this? Would NHibernate support this activity with a little effort on my end?
Yes, you can use <database-object> to add any additional artifacts (comments, indexes, triggers, etc) that you need.
See 5.6. Auxiliary Database Objects