How to filter by non-null values? - hasura

Is it possible in the Hasura web app, to filter by values which aren't null?

Not sure about the explorer there, but you can do it easily in the API tabs Graphiql explorer:
query {
my_table(where: {trailer_id: {_is_null: false}}) {
fields_here
}
}

Related

Flutter firebase query not working as expected [duplicate]

I want to query my Workout Collection for the latest workout from a routine. Meaning I query with whereEqualTo my routineKey, order it by the Started TimeStamp in descending order and then limit to 1 and then take the this 1st Key/Id of the Workout.
However this does not work. whereEqualTo and orderBy work separately but not combined. What am I doing wrong?
fm.getColRefWorkout().whereEqualTo("routineKey", routineKey).orderBy("startTimeStamp", Query.Direction.DESCENDING).limit(1).get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
#Override
public void onSuccess(QuerySnapshot documentSnapshots) {
workoutKey = documentSnapshots.getDocuments().get(0).getId();
//To stuff with this workoutKey
}
});
This query will not work unless you create an index for it. This can be done, by creating it manually in your Firebase Console or if you are using Android Studio, you'll find in your logcat a message that sounds like this:
FAILED_PRECONDITION: The query requires an index. You can create it here: ...
You can simply click on that link or copy and paste the URL into a web browser and your index will be created automatically.

Marketo - REST API field for Microsoft Type

In case of a sync between Marketo and Microsoft Dynamics the "Microsoft Type" field is added to leads data.
The issue is that there is no access to "Microsoft Type" field via REST API. I don't find its REST API name in the export fields document.
Any idea why it's not available or anyone knows the REST API name for Microsoft Type field?
Well, we integrated our Marketo instance with Salesforce, so I'm not 100% sure how the Type field is called in case of Microsoft Dynamics. However, based on the Salesforce integration (where the API name of the SFDC Type field is sfdcType) I would expect it to be "microsoftType".
To make sure, I would make a call to the Describe Lead API endpoint –at GET /rest/v1/leads/describe.json– to get a list of the field names available on the Lead object.
The response looks something like this:
[
{
"id":4,
"displayName":"Company Name",
"dataType":"string",
"length":255,
"rest": {
"name":"company",
"readOnly":false
},
"soap": {
"name":"Company",
"readOnly":false
}
}
// … other field descriptions
{
"id":90,
"displayName":"SFDC Type",
"dataType":"string",
"length":50,
"rest": {
"name":"sfdcType",// <- REST API name
"readOnly":true
}
}
// … other field descriptions
]
I've made a custom field(Marketo Microsoft Type) and a campaign where I assign Microsoft Type value to the new created custom field

Is there a way to generate a push ID from the Console in the new Realtime Database?

I have a listing node in my Database and wanted to add data into it from the web console. I want to have a push ID as the key of the object. Something like this :
{
"listing": {
"4acd4g1OreMyo2FkW6DlQH7ZhvY2": {
"name": "abc",
"location": "xyz"
}
}
}
where '4acd4g1OreMyo2FkW6DlQH7ZhvY2' would be the auto generated push ID.
I know it can be done using the Android/iOS/JS SDKs (using the push method). But is this possible from the console?
No, the console doesn't support it currently. I've been using firebase for a while and I've never needed it :)
while firebase console doesn't support it officially, there is a service called mockaroo that can generate firebase random id. Make sure to pick firebase option in the format dropdown

Firebase "Where" like search

Tryng to get a simple result using "Where" style in firebase but get null althe time, anyone can help with that?
http://jsfiddle.net/vQEmt/68/
new Firebase("https://examples-sql-queries.firebaseio.com/messages")
.startAt('Inigo Montoya')
.endAt('Inigo Montoya')
.once('value', show);
function show(snap) {
$('pre').text(JSON.stringify(snap.val(), null, 2));
}
Looking at the applicable records, I see that the .priority is set to the timestamp, not the username.
Thus, you can't startAt/endAt the user's name as you've attempted here. Those are only applicable to the .priority field. These capabilities will be expanding significantly over the next year, as enhancements to the Firebase API continue to roll out.
For now, your best option for arbitrary search of fields is use a search engine. It's wicked-easy to spin one up and have the full power of a search engine at your fingertips, rather than mucking with glacial SQL-esque queries. It looks like you've already stumbled on the appropriate blog posts for that topic.
You can, of course, use an index which lists users by name and stores the keys of all their post ids. And, considering this is a very small data set--less than 100k--could even just grab the whole thing and search it on the client (larger data sets could use endAt/startAt/limit to grab a recent subset of messages):
new Firebase("https://examples-sql-queries.firebaseio.com/messages").once('value', function(snapshot) {
var messages = [];
snapshot.forEach(function(ss) {
if( ss.val().name === "Inigo Montoya" ) {
messages.push(ss.val());
}
});
console.log(messages);
});
Also see: Database-style queries with Firebase

Using the Freebase search api mql_output parameter to obtain linked data

I am trying to use the freebase search API to obtain the parties of specific politicians as well as general biographical data (using php). I know that the search api passes the id of each search result found to an MQL query specified by the mql_output parameter.
Here is the MQL query I have at the moment which I use for the mql_ouput parameter
{
"name":null,
"/people/person/date_of_birth":null,
"/people/person/gender":null,
"/wikipedia/topic/en_id":null,
"id":null,
"/government/politician/party":[
{
party : null
}
]
}
and this is the resultant query url
https://www.googleapis.com/freebase/v1/search?Barrack%20Obama&filter=%28all%20type%3Apolitician%29&mql_output=%7B%22name%22%3Anull%2C%22%5C%2Fpeople%5C%2Fperson%5C%2Fdate_of_birth%22%3Anull%2C%22%5C%2Fpeople%5C%2Fperson%5C%2Fgender%22%3Anull%2C%22%5C%2Fwikipedia%5C%2Ftopic%5C%2Fen_id%22%3Anull%2C%22id%22%3Anull%2C%22%5C%2Fgovernment%5C%2Fpolitician%5C%2Fparty%22%3A%5B%7B%7D%5D%7D&key=AIzaSyDdJ_9L6mcWXinx5Lehku2TULmJhOMESew&indent=true
Thanks for your help, sorry that it's quite basic question,
Mark
Answer
Could not self answer due to not enough forum rep.
I just realised what I needed to do after going over some more examples. To have the database retrieve the party information I needed to use the following query.
{
"name":null,
"/people/person/date_of_birth":null,
"/people/person/gender":null,
"/wikipedia/topic/en_id":null,
"id":null,
"/government/politician/party":{
"party" : null
}
}
Mark
I just realised what I needed to do after going over some more examples. To have the database retrieve the party information I needed to use the following query.
{ "name":null, "/people/person/date_of_birth":null, "/people/person/gender":null, "/wikipedia/topic/en_id":null, "id":null, "/government/politician/party":{ "party" : null } }
Mark

Resources