OR operation with postgREST API - postgrest

Consider I have two columns using which I want to fetch the rows. The condition would be
WHERE column1="test" OR column2="test"
How do I achieve this with postgREST API?

Your request would be:
GET /table?or=(column1.eq.test,column2.eq.test) HTTP/1.1
The recently added Logical Operators section in the docs has a more practical example.

Related

Cloud Data Fusion - Input HTTP Post Body from BQ rows

I am a new cloud data fusion user and have run into a problem I cant find a solution for.
I have a table in BQ with ~150 rows of latitude and longitude points. For each row, I want to pass the lat and lng into an HTTP post request to get a result from TravelTime API. Ultimately I want to have a table with all my original rows with a column with the response for each one/
Where I am stuck is that so far I have only been able to hard-code the body of the post request into the HTPP Source plugin and successfully write the response to a file in gcs. However, I expect the rows will change over time, so I would like to dynamically generate and pass in the POST request body from my BQ data.
Is this possible with data fusion? Is this an advisable approach? Or is there a better way?
As #Albert Shau and #user3750486 agreed in the comments:
There is no out-of-the-box way to pass data from BQ rows dynamically in a POST HTTP request.
A possible workaround is to have an HTTP transform plugin that sits in the middle of the pipeline and can be configured to make calls based on the input data. Then you would have a BQ source followed by that plugin followed by the GCS sink. I think your best bet would be to write a custom transform.
This can be done by following this link that #Albert Shau provided or to do a custom code using GCP's Cloud Function as OP did.
Posting the answer as community wiki for the benefit of the community that might encounter this use case in the future.
Feel free to edit this answer for additional information.

WSO2is SCIM query with two filters

I understand that it is not possible to use the 'or' operator to make queries.
What alternative is there to perform a query with two filters for same attribute but diffrente query, for example:
scim2/Users?filter=field+sw+content-a&filter=field+sw+content-b
This Git issue is still in open state. Therefore, believe this has not yet been implemented.
You can achieve your requirement using 2 SCIM calls(One for each filter). Then programatically get the union of the results. Same goes for NOT operator as well. You have to perform multiple SCIM calls and programtically obtain the end result.

How about this 20MB json response performance?

I have a API build in django, it goes to query data with PostgreSQL and serializer to json.
Now, this API content-length is 3MB (I use the gzip, the truely size is 20MB) response time cost me about 10~20 seconds.
I want to ask, Is this performance is right? there is any optimization space that I can do?
If it takes 10-20 seconds, it sounds more like poor API design, however I don't know your use-case so I can't be sure.
Check if you can do any of the recommendations of Ken. Here are some more ideas:
Pagination is a great way to split data - if your data can be split into logical parts, DRF has a great number of ways to paginate querysets.
Using the right gzip compression level could be a factor, given the size of your data. Read more about it here
See if you can use etag option, where the server sends a 304 Not Modified if the API response has not changed between two consecutive calls to the API. DRF does not support etags out-of-the-box AFAIK, so you will have to find a work-around.
Since you mentioned "real-time" data, I am assuming there's some concept of streaming of temporal data. There are interesting ways to do combine client caching + cursor based pagination to only send the 'new data' you can explore. This only works if the two preconditions are met: The changes to your API are incremental and temporal in nature.

Does user search query support OR clause for Orgunits?

I'm trying to use the google directory api to get a specific set of users based on their orgUnitPath. I can't seem to get a query working where I do something like orgUnitPath=/OUTest OR orgUnitPath=/LeftOU without having to make two separate api calls. Any advice.
The query does not support OR. Currently two API calls will be necessary.

WSO2 DSS Complex input

We are trying to build a data service that take three kind of filters and run a union query to get the metadata based on the passed filters.
The three kind of filters are made of complex data types, when we checked the WSO2 DSS we were not able to do an input mapping for complex types, is that not feasible?
We are trying to get all metadata with one shot though we are getting different inputs and we can't do it scalar as for example all metadata objects has name column.
Can anybody help?
I'm afraid, WSO2 DSS at the moment, does not support complex input types. But we are planning on introducing this in the next DSS 4.0.0 version. There, you would be able to pass in a complex input, and also execute multiple queries in a single operation.
Cheers,
Anjana.