Usage of clickhouse url engine with query string - clickhouse

As of
https://clickhouse.com/docs/en/engines/table-engines/special/url/
we can query data from a remote HTTP/HTTPS server.
The problem is I need to pass query string to URL.
Is there any way to do it?

Look https://clickhouse.com/docs/en/sql-reference/table-functions/url
you can use
SELECT * FROM url('https://host:port/path?param=value', <format> , 'stucture')

Related

Not able to retrieve the Date and Time fields data from redis DB by using RediSearch

We are using RediSearch (io.rediseach.client.Cleint) in spring boot application for getting the records from redis DB. We are not able to get the date and time column values(ex: date as 07/21/2021 and time as 09:12) and other columns are retrieved properly. Could you please help me on this and is there anything we need to add in search query)
below is the code for reference
private final Client client; Query q = new Query("#columnName:"+columnValue); ex: Query q = new Query("#empName:"+raju); SearchResult result = client.search(q);
It seems like you are missing escaping on the query side.
RediSearch parser requires users to escape special characters.
You can read more about it at Controlling Text Tokenization and Escaping on redisearch.io.

Running queries dynamically

I have my Sql query stored as value in one of key attributes in MongoDb database.I am able to fetch the records from the MongoDb database.I want to run the sql query assosciated after retrieving it from there.
The format of record is as follow:
{
"Id":2,
"Type":"SqlQuery",
"Syntax":"select id from table_name where id = pid and optional_id in ('AC','SU')",
"ValueSpecifiers":{
"id":"request.id"
}
}
I am beginner in springboot.It would be very helpful if someone could guide me some resource or in correct direction .I am confused about is it possible to hit queries by setting few filter parameters here like id dynamically as it varies with request object.I want to run it dynamically without extending crud repository.Its just like hitting db by native queries.
You could use a character like "?" on your recorded query, and then you replace it with your filters. Example:
In the database you save the query like
select id from table_name where id = pid and optional_id in (?)
And then you retrieve the query to a variable and replace the "?" with the parameters you want to filter. Something like
varQuery.replace("?", "'AC', 'SU'")
or
Replace(varQuery, "?", "'AC', 'SU'")

Get BigQuery metadata when performing query (Ruby)

When performing a query against BigQuery, it outputs useful info in logs, but the return value is simply the query payload. Is there any way to programmatically get the query metadata in addition to the query result?
Example:
bigquery = Google::Cloud::Bigquery.new(…)
result = bigquery.query(sql)
Debug-level logs will show something like:
#total_bytes_processed=102412,
#total_rows=12915
I'm wondering how that could be accessed programmatically.
Don't know the specifics of Ruby (I don't use that language), but when you submit your query, you'll get back a "job id". Use this id to retrieve the meta information about the job/query using the Job API.
https://cloud.google.com/bigquery/docs/jobs-overview
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/get
https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs#resource

Get distinct values from a field in ElasticSearch via a REST API URI

I have the following URI which should retrieve all values from the Gender field.
http://localhost:9200/persons/_search?_source=Gender
However, it does not return me all the data in the index of the Gender field. I want to get the data distinct also.
I am consuming this REST API in AngularJS. Can someone help me to achieve this type of URI query ?
Thank you.
Elasticsearch returns 10 hits by default, unless otherwise specified by size.
To get distinct values of a field use terms aggregation.
Refer: ES-return-unique-values

Pass an IP in YQL query

Is there a way to pass an ip in a YQL query statement?
The page im querying returns data based on the ip that is querying the page(date/timezone), so I'm getting data that is useless to the user that is not from the user IP.
What's the proper syntax to passing an IP if it is possible?
Thanks
You can use IP address instead of url, here is example:
SELECT * FROM html WHERE url = "93.184.216.34"
Sample curl command querying Google IP:
$ curl -G --data-urlencode 'q=SELECT * FROM html WHERE url = "216.58.210.14" AND xpath="//input"' http://query.yahooapis.com/v1/public/yql

Resources