When typing my query for Streaming Analytics I don't receive any error messages, however, when I start my streaming analytics job, I receive the following error:
Stream Analytics job has validation errors: The output dsleads used in the query was not defined. Activity Id: '5cc961c5-4dbd-4a63-95df-8e3b08d2121c-2016-03-28 14:56:21Z'.
I've checked the output name and have verified that it's correct. I'm not sure what I'm doing wrong. The query I'm using is as follows:
SELECT type, count(*) as count, system.timestamp as time
INTO dsleads
FROM ttvhuball timestamp by time
GROUP BY type, TumblingWindow(minute, 10)
I've scoured the internet and have not found anything helpful.
seems like an output alias error. Is the output sink alias that you've created(that is you give a name to it during creation) "dsleads" in your case?
Also worth mentioning INTO is the output and FROM is the input. INTO always needs to come before FROM in the query as well.
Hope this helps!
Mert
I was using the incorrect output name. One needs to specify the output name. I was specifying the dataset name of the output I needed to specify.
Related
I have to upload a JSON load into the big query. While uploading the load I got the below-mentioned error.
I debug and found that it is failing on this JSON record which seems to be valid.
{"firebaseUid":"00FKNF7x2BQhDoPk9TSzE4Ncepn1","age_range":{"min":21},"signUpApp":"stationApp","uid":"00FKNF7x2BQhDoPk9TSzE4Ncepn1","locale":"en_US","emailSha256":"501a8456ececb2a50e733eed6c64b840d63d3aad99fb9ad4a1bbd2cbc33fc1f6","loginMethod":"facebook","notificationToken":"dummy","ageRangeMin":21,"pushNotificationEnabled":true,"projectId":"triplembaas","createDate":"13/07/2018","state":"QLD","station":"TripleM 104.5","facebookId":"1021TheHotBreakfast740157586","email":"connollyharley#gmail.com","cellularNetwork":"OPTUS","suburb":"Bellara","idfa":"60A63734A27E40249331658F1AC670A1","deviceId":"BBD901JaseJuelz454E100000000000000000","firstSignUpDate":"13/07/2018","name":"Harley Connolly","gender":"male","emailVerificationFlag":false,"lastUpdateDate":"20/07/2018","link":"dummy"}
Error while reading data, error message: JSON table encountered too many errors, giving up. Rows: 1; errors: 1. Please look into the error stream for more details.
Probably I am late but for anyone still looking for answer try this.
Change your date format to "YYYY-MM-DD". Somehow bigquery detects that the field value is Date and it won't allow any other format of date instead of "YYYY-MM-DD"
I'm trying to sort/order a table (Employer) based on the number of associated records (Employee) each (Employer) has.
The following code works on rails console with the Employer records sorted by number of Employees as intended :
Employer.joins(:employees).group(:id).order('count(employees.id) ASC')
However, when actually trying to run this on development, I get this error:
PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
While I could use 'sort_by", I would prefer to have the result in ActiveRecord::Relation format. Any help would be appreciated.
I was able to reproduce this error in the console by adding distinct to the expression:
In your case it would be:
Employer.distinct.joins(:employees).group(:id).order('count(employees.id) ASC')
The error message says that you have to add the expression you sort by (count(employees.id)) to the select list.
That could be achieved by explicitly specifying select columns:
Employer.select('employers.id, count(employees.id)').joins(:employees).group(:id).order('count(employees.id) ASC')
I'm trying to make a N1QL based query on Spring Data Couchbase. The documentation says
#n1ql.fields will be replaced by the list of fields (eg. for a SELECT clause) necessary to reconstruct the entity.
My repository implementation is this one:
#Query("#{#n1ql.fields} WHERE #{#n1ql.filter}")
List<User> findAllByFields(String fields);
And I'm calling this query as follows:
this.userRepository.findAllByFields("SELECT firstName FROM default");
I'm getting this error:
Caused by: org.springframework.data.couchbase.core.CouchbaseQueryExecutionException: Unable to execute query due to the following n1ql errors:
{"msg":"syntax error - at AS","code":3000}
After a little bit of researching, I also tryed:
#Query("SELECT #{#n1ql.fields} FROM #{#n1ql.bucket} WHERE #{#n1ql.filter}")
With this query, I don't get an error, I get all the documents stored but only the ID the other fields are set to null, when my query tries to get the firstName field.
this.userRepository.findAllByFields("firstName");
Anyone knows how to do such a query?
Thank you in advance.
You're misunderstanding the concept, I encourage you to give the documentation more time and see more examples. I'm not sure what exactly you're trying to achieve but I'll throw some examples.
Find all users (with all of their stored data)
#Query("#{#n1ql.selectEntity} WHERE #{#n1ql.filter}")
List<User> findAllUsers();
This will basically generate SELECT meta().id,_cas,* FROM bucket WHERE type='com.example.User'
Notice findAllUsers() does not take any parameters because there are no param placeholders defined in the #Query above.
Find all users where firstName like
#Query("#{#n1ql.selectEntity} WHERE #{#n1ql.filter} AND firstName like $1")
List<User> findByFirstNameLike(String keyword);
This will generate something like the above query but with an extra where condition firstName like
Notice this method takes a keyword because there is a param placeholder defined $1.
Notice in the documentation it says
#{#n1ql.selectEntity} WHERE #{#n1ql.filter} AND test = $1
is equivalent to
SELECT #{#n1ql.fields} FROM #{#n1ql.bucket} WHERE
#{#n1ql.filter} AND test = $1
Now if you don't want to fetch all the data for user(s), you'll need to specify the fields being selected, read following links for more info
How to fetch a field from document using n1ql with spring-data-couchbase
https://docs.spring.io/spring-data/couchbase/docs/2.2.4.RELEASE/reference/html/#_dto_projections
I think you should try below query, that should resolve the issue to get fields based parameter you have sent as arguments.
Please refer blow query.
#Query("SELECT $1 FROM #{#n1q1.bucket} WHERE #{#n1ql.filter}")
List findByFirstName(String fieldName);
Here, bucket name resolve to the User entity and and n1ql.filter would be a default filter.
So, I am trying to execute a query using ArcGIS API, but it should match any Json queries. I am kind of new to this query format, so I am pretty sure I must be missing something, but I can't figure out what it is.
This page allows for testing queries on the database before I actually implement them in my code. Features in this database have several fields, including OBJECTID and Identificatie. I would like to, for example, select the feature where Identificatie = 1. If I enter this in the Where field though (Identificatie = 1) an error Failed to execute appears. This happens for every field, except for OBJECTID. Querying where OBJECTID = 1 returns the correct results. I am obviously doing something wrong, but I don't get it why OBJECTID does work here. A brief explanation (or a link to a page documenting queries for JSON, which I haven't found), would be appreciated!
Identificatie, along with most other fields in the service you're using, is a string field. Therefore, you need to use single quotes in your WHERE clause:
Identificatie = '1'
Or to get one that actually exists:
Identificatie = '1714100000729432'
OBJECTID = 1 works without quotes because it's a numeric field.
Here's a link to the correct query. And here's a link to the query with all output fields included.
In my application am using JPA entity manager to persist data/fetch data.
em.executeQuery("select * from file_calender_mapping where start_date between :start and :end");
em.setParameter("start",startDate)//startDate is an date object
em.setParameter("end",endDate)//endDate is an date object
List fmlist=em.execute();
The proble is just like this,
"select * from file_calender_mapping where start_date between start and end"
when am passing some date as start= "2011-08-03 05:08:00",and end="2011-08-04 06:08:00"
then the mysql return one row having the start time ="2011-08-03 05:30:00",its good,But
when my application executing such query it dose not returning any row.Actually what i have seen that my application returning value for two different date,but not for same date different time,thats the main problem.
One another thing is my "start" field for Table "file_calender_mapping" datatype is "timestamp".
So what i was thinking that ther may be some problem on JPA/Hibernate
You can try to specify the exact types of parameters as follows:
em.setParameter("start", startDate, TemporalType.TIMESTAMP);
em.setParameter("end",endDate, TemporalType.TIMESTAMP);
I have the strong feeling that you're confusing EntityManager.createQuery() with EntityManager.createNativeQuery() and you're somehow capturing all the exceptions, which somehow makes you don't receive anything back.
I'm assuming that, because I don't think you have a class named file_calender_mapping.
edit
The documentation will explain it better than I do, but a JPA QL query is transformed to the navite sql of the DB using the mapping, while a native query is send as it's to the DB.
Again, I suggest you to read the documentation, it's quite useful.