Solr query to Postman's raw data query - solr

This is my Solr query: qt section: /select
q section: -nest_path:*
fl section: *, [child limit=-1]
Solr query
and I wanna convert this to Postman's form-data like " stmt: select id,title from TABLE_NAME where author_code is not null limit 100 " to reach same result.

If you execute your query from the Solr Admin web page you should see the corresponding URL that you will need for Postman at the top of the page
In this case the URL will be:
http://localhost:8983/solr/puldata/select?fl=*%2C%20%5Bchild%20limit%3D-1%5D&q=-nest_path%3A*
I am not sure your query is valid, though. But that would be a different issue.

Related

PyFlink - Issue with UNNEST: query uses an unsupported SQL feature?

I am trying to flatten an array using UNNEST function in the Table API.
Am I doing something wrong or it is not a supported function ? This page suggests it though: https://ci.apache.org/projects/flink/flink-docs-master/dev/table/sql/queries.html
Thanks !
Code
Python udf
#udf(input_types=DataTypes.STRING(), result_type=DataTypes.ARRAY(DataTypes.STRING()))
def explode(s):
return 3*[s]
t_env.register_function("explode", explode)
Processing
tab = t_env.from_path('mySource').select("id, explode(dummy) as dummy_list")
t_env.register_table("temp_table", tab)
t_env.sql_query("SELECT t.item as dummy_item FROM UNNEST(select dummy_list from temp_table) AS t(item)").insert_into("mySink")
Execution
t_env.execute("dummy_unnest")
Error
TableException: Cannot generate a valid execution plan for the given query:
LogicalProject(dummy_item=[$0])
Uncollect
LogicalProject(EXPR$0=[org$apache$flink$table$functions$python$PythonScalarFunction$908596b4671476ee325743dba92ed6c7($1)])
LogicalTableScan(table=[[default_catalog, default_database, mySource]])
This exception indicates that the query uses an unsupported SQL feature.
Please check the documentation for the set of currently supported SQL features.
I think you can change the query to
select id, dummy_item from temp_table CROSS JOIN UNNEST(dummy_list) AS t (dummy_item)

MSD CRM: Get the count of records of all entities in CRM

I am working on to get the record count of every entity available in the CRM. I have seen so many solutions are available on the internet But I have searched in the database(As we have on-prem) and found one table called 'RecordCountSnapshot' has the count(and answer to my question). I am wondering can we query that table somehow and get the count.
I have tried using OData Query builder, I am able to prepare a query but unable to get the result.
Query:
Result:
We are using CRM 2015 on-prem version.
Go to Settings -> Customizations -> Developer Resources -> Service Endpoints -> Organization Data Service
Open by clicking /XRMServices/2011/OrganizationData.svc/, it is missing the definition for RecordCountSnapshot. That means this entity is not serviceable by OData. Even if you modify the other OData query url to use RecordCountSnapshotSet you will get 'Not found' error. (I tried in CRM REST builder)
1) As you are in Onpremise, You can use this query:
SELECT TOP 1000 [Count]
,[RecordCountSnapshotId]
,entityview.ObjectTypeCode, Name
FROM [YOURCRM_MSCRM].[dbo].[RecordCountSnapshot] , EntityView
where entityview.ObjectTypeCode = RecordCountSnapshot.ObjectTypeCode
and count > 0 order by count desc
2) In Odata Query Designer, you have statistics tab. Use it to get the records count.
One option to get the counts of all entities is to run this SQL query against the MSCRM database:
SELECT SO.Name, SI.rows
FROM sysindexes SI, SysObjects SO
WHERE SI.id = SO.ID AND SO.Type = 'U' AND SI.indid < 2
order by rows DESC
I have also built a command line app that's in beta testing that runs a count of all entities. If you're interested, let's chat.

PostgreSQL query not working in Yii2

I want to execute query in my yii2 application. I'm using PostgreSQl. There is a table called list inside the user schema. If I try to build any query it returns 1. My code is here:
$numUsers = Yii::$app->db->createCommand('
SELECT COUNT(*) FROM "user"."list"
')->execute();
Please show me my mistake in the query above.
This is not related to the DB type in Yii2 if you want the result of a single value you should use queryScalar() instead of execute()
$numUsers = Yii::$app->db->createCommand('
SELECT COUNT(*) FROM "user"."list" ')->queryScalar();

How do I execute this query in GQL [Google App engine]?

I have a table of projects with two of it's columns as 'language' and 'tag'.
After the user gives an input, I want to output all the projects whose language is input or tag is input.
Sql query for above would be this,
Sql query: Select * from TableName where language='input' OR tag='input'
I tried to execute the same in Gql but in vain. What should be the query in Gql to output the data in the above mentioned way.
GQL doesn't have OR, so basically you have to make two separate queries and union results:
Select * from TableName where language='input'
Select * from TableName where tag='input'
You should join results on your app side, Cloud Console doesn't support such things too.
See GQL reference: https://cloud.google.com/datastore/docs/apis/gql/gql_reference
I don't know if is mandatory for you to use GQL, but in case you are able to avoid it, you can use the ndb filter instead.
results = TableName.query(ndb.OR(TableName.language == 'input',
TableName.tag == 'input'))
for result in results:
....your code here...
More information in: https://cloud.google.com/appengine/docs/python/ndb/queries

SQL Query + Google Geocode Response XML

I have the XML response from the Google Geocoding API stored in a SQL Server XML column. Can someone help me with a query that will return all rows where the XML contains > 1 result?
e.g.
<GeocodeResponse>
<status>OK</status>
<result></result> <!-- more than one result is present -->
<result></result>
<result></result>
</GeocodeResponse>
So something like this gives me the first result:
SELECT XmlResponse.query('/GeocodeResponse/result') FROM Locations
But I'm not sure where to go from here...
You can use the exist() method of the XML data type to check if there exist a second <result> node.
select *
from Locations
where XmlResponse.exist('GeocodeResponse/result[2]') = 1
Test the query here. https://data.stackexchange.com/stackoverflow/q/101340/xmlcolumn-exist

Resources