Odata pulling different times? - odata

When I pull data using ODATA in excel I get time with -3hrs compared to the one in the instance.
Is there a way I can get the exact time as the one on the instance?
Comaparison of instance time and Excel time pic
I tried to check the server time to make sure its the same as the one on the instance. My SQL server
is in UTC. could this be the reason why? It seems ODATA might be fetching data directly from the database through the generic inquiry.

the problem is that the records were saved in the wrong timezone (server or SQL)
In the GI take the column that is wrong and add this:
=DateAdd(today(),’h’, 3)
Replace 'today()' with your needed field, now the data will display as you want them

Related

Why does my infulxdb insert a new row of data only every 10 seconds?

I wrote a timed task in c# to insert one row of data per second,
but I found that only one row of data is inserted every 10 seconds.
I also noticed that new insert requests within 10 seconds will only update the same row of data and not insert a new one.
What is the setting that causes this and how do I change it?
The version of influxdb is 2.2, I downloaded it from the website and started it directly without changing any configuration.
You are probably using query creator which aggregates data (prepares query with aggregation). Example setting in InfluxDB v2 web GUI:
Setting period to 1s or writing your own query without any aggregation should solve your problem.
What is more: writing data with the same tag keys to InfluxDB, with the same timestamp and the same value field name will overwrite existing value in InfluxDB. So described behaviour is normal.

How to set/update expiration time for a table in Google big Query using ruby

I am using google-cloud-bigquery gem for my Ruby on Rails application. I am able to execute the query on the dataset and do the following
Execute query
Create destination table and store results into it
Store the final results into a file from a destination table
Now I want to set the expiration time for the destination table. I find a document to updating a table. But I am unable to find a way to set the expiration time using Ruby language?
Also I am able to fetch expires_at value from a table which returns nil. I don't find a way to set it.
Kindly help
I'm no Ruby expert, but I also cannot find anything in the docs/api that allows you to set the expiration on a table. You can do it at the dataset level (here) or for partitions on the table (here). It looks like it's not exposed via the client library for some reason.
Another way of doing it is via DDL in SQL e.g:
ALTER TABLE mydataset.mytable
SET OPTIONS (
expiration_timestamp=TIMESTAMP_ADD(CURRENT_TIMESTAMP(), INTERVAL 7 DAY),
description="Table that expires seven days from now"
)

Is there a way to manually insert records into InfluxDB with custom timestamps via telegraf?

https://github.com/influxdata/telegraf/pull/1557
Apparently some people have been asking for this, and this Github PR is the closest thing I can find to a solution, but it was ultimately denied(I think?).
Basically, I have a JSON object I'm getting from Stackdriver, which includes a Timestamp in ISO8601, which I convert to Unix time. I can insert the entire JSON response into Influx fine, but the timestamp from Stackdriver appears as a tag for a series, rather than the index of the time series itself. As a result, it is unfeasible to query by Stackdriver's provided timestamp. I could simply just drop it, and use the Influx provided timestamp, but it is essentially querying incorrect/imprecise data.
Does anyone have a clever way to approach this?
tl;dr How can I use Telegraf to override InfluxDB's timestamps with my own timestamps?

Get latest record for each user with ODATA

Due to the PowerShell methods of getting mailbox statistics from Office365 taking about 2 seconds per mailbox, I am working on getting the data from Office 365 Reporting web service, which takes only a few seconds for each 2000 mailboxes.
The problem I'm running into is that the stats are updated periodically and some historical data is kept, so there are numerous records for each user. I only want to get the latest record for each user, but I haven't been able to find a way to do that. The closest I've come is to use $filter=Date ge DateTime'2016-03-10T00:00:00' where the date is concatenated to a couple of days ago. Theoretically, if I sort by Date desc I should get the latest records first, and if there is a user that has a record for 3/10 and 3/11, the 3/11 record would get pulled first, which would work for me. But regardless of how I do the sort it seems to come back with the older records first.
Ideally, I would like to be able to set criteria so that it only returns the latest record for each mailbox, but I can't seem to figure out or find how to do that. The closest I've been able to come is to just start running queries filtered on specific dates, walking the date back a day on each query.
If I can get the latest records to be returned first, I would be able to work with that because I can just discard a record if I've already received a later one.
https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MailboxUsageDetail/
?DelegatedOrg=nnn.onmicrosoft.com&$select=Date,WindowsLiveID,CurrentMailboxSize
&$filter=Date ge DateTime'2016-03-08T00:00:00'&$orderby=Date desc
So the questions are:
Is there a way to specify criteria so that only the latest record for each user is returned?
Is there a way to get it to order by Date descending--what am I doing wrong with the $orderby?
Thanks!
You can use $top=1 to get latest record by applying $orderby on date (desc). $filter and $skip may not require in this case.
https://reports.office365.com/ecp/reportingwebservice/reporting.svc/MailboxUsageDetail/?DelegatedOrg=nnn.onmicrosoft.com&$select=Date,WindowsLiveID,CurrentMailboxSize&$orderby=Date desc&$top=1
Your query looks fine, here is an another example from Odata sample service to get employee detail with most recent birth date.
http://services.odata.org/V4/Northwind/Northwind.svc/Employees?$select=EmployeeID,FirstName,LastName,BirthDate&$orderby=BirthDate%20desc&$top=1

Using time dimension in OWB

I started to work with Oracle Warehouse Builder a few days ago, and I want to use some of the dates in a source table as a dimension.
I generated the time dimension with the wizard, but there is no way to connect the stored dates in my sourcetable to the generated time dimension. How should I do that?
I'm sure I'm misunderstanding something.
Thanks!
In your time dimension you should have the actual date time representation that Oracle uses in your source table. You simply join on that to get the DateKey.

Resources