temporal-database

historical data load from SQL to teradata temporal table

雨燕双飞 提交于 2019-12-25 01:41:58
问题 I need to do a historical type 2 data from a SQL server table to treat temporal table. I asked this question earlier but did not ask it completely and only 1st part was mentioned in question. below is link for same: Previous Question with Answer Sorry if I am duplicating question but that thread looks dead and I can use some help here. I need have three versions of data in SQL server Version 1,2,3. e.g. Version 1 - Effective start date Effective End Date 1/1/10 1/1/11 Version 2 - Effective

Detect Anomaly Intervals with SQL

╄→尐↘猪︶ㄣ 提交于 2019-12-20 15:34:31
问题 My problem is simple: I have a table with a series of statuses and timestamps (for the sake of curiosity, these statuses indicate alarm levels) and I would like to query this table in order to get duration between two statuses. Seems simple, but here comes the tricky part: I can´t create look-up tables, procedures and it should be as fast as possible as this table is a little monster holding over 1 billion records (no kidding!)... The schema is drop dead simple: [pk] Time Value (actualy,

Detect Anomaly Intervals with SQL

☆樱花仙子☆ 提交于 2019-12-20 15:33:08
问题 My problem is simple: I have a table with a series of statuses and timestamps (for the sake of curiosity, these statuses indicate alarm levels) and I would like to query this table in order to get duration between two statuses. Seems simple, but here comes the tricky part: I can´t create look-up tables, procedures and it should be as fast as possible as this table is a little monster holding over 1 billion records (no kidding!)... The schema is drop dead simple: [pk] Time Value (actualy,

Django custom creation manager logic for temporal database

前提是你 提交于 2019-12-13 03:22:48
问题 I am trying to develop a Django application that has built-in logic around temporal states for objects. The desire is to be able to have a singular object representing a resource, while having attributes of that resource be able to change over time. For example, a desired use case is to query the owner of a resource at any given time (last year, yesterday, tomorrow, next year, ...). Here is what I am working with... class Resource(models.Model): id = models.AutoField(primary_key=True) class

Load Historical data to teradata temporal table

会有一股神秘感。 提交于 2019-12-12 18:37:57
问题 I have a task to load existing SQL Server table to Teradata temporal table. Existing table is a type 2 table and has many versions of record. I need to load them into teradata temporal table. I am planning to load version 1 1st and then update all other versions one by one. Difficulties i am having is that in existing table every record has start time and end time. I need to update that time in teradata temporal table as validity. 1st I am trying to insert and while insert i am not able to

Extracting and Averaging instintanous values in temporal DB in postgresql

前提是你 提交于 2019-12-11 18:45:21
问题 I have a temporal database and I wanted to average the data with respect to the: ` HH = (HH-1):41 - HH:40 For example: 13 = observation period 12:41 to 13:40. Expected results: The code should subtract the instantaneous value of HH:40 from (HH-1):41. Sample data: temperature date-time 1 -1.64 2007-09-29 00:01:09 2 -1.76 2007-09-29 00:03:09 3 -1.83 2007-09-29 00:05:09 4 -1.86 2007-09-29 00:07:09 5 -1.94 2007-09-29 00:09:09 6 -1.87 2007-09-29 00:11:09 7 -1.87 2007-09-29 00:13:09 8 -1.80 2007-09

Average aggregation on temporal DB based on measurment with 10-minute intervals in PostgreSQL

 ̄綄美尐妖づ 提交于 2019-12-11 04:37:18
问题 I have a temporal database and I want to perform the temporal aggregation via average function on time series data by using data in time sequence of following: Hourly average of HH= (HH-1):51, HH:01, HH:11, HH:21, HH:31, HH:41. Moreover, aforementioned values are instantaneous values. Sample data: ambtemp ddate_ttime 1 -1.42 2007-09-28 23:39:09 2 -1.24 2007-09-28 23:41:09 3 -1.28 2007-09-28 23:43:09 4 -1.28 2007-09-28 23:45:09 5 -1.24 2007-09-28 23:47:09 6 -1.42 2007-09-28 23:49:09 7 -1.68

temporal database modeling and normalisation

*爱你&永不变心* 提交于 2019-12-09 13:36:02
问题 Should dates for a temporal database stored in one or 2 tables ? If one doesn't this violate normalisation ? PERSON1 DATE11 DATE21 INFO11 INFO21 DEPRECATED PERSON2 DATE21 DATE22 INFO21 INFO22 CURRENT PERSON1 DATE31 DATE32 INFO31 INFO32 CURRENT DATE1 and DATE2 Columns indicate that INFO1 and INFO2 are true for the period between DATE1 and DATE2. If DATE < TODAY, the facts are deprecated and shouldn't show any more in the user interface but they shouldn't be deleted for historical purpose. For

Why does the FOR Clause not work with an alias in SQL Server 2016 with temporal tables?

爷,独闯天下 提交于 2019-12-08 19:47:36
问题 I have a SQL Server 2016 database with temporal tables. One temporal table is called Company. I am trying to query it to get current records and all historical records. I first tried the following query: select * from Company c FOR SYSTEM_TIME all and got the following error: Incorrect syntax near 'FOR'. However, if I try it without the alias it works fine: select * from Company FOR SYSTEM_TIME all I could not find any documentation about this- is it a legitimate constraint, a known issue, or

What is the best way to query deleted records with SQL Server 2016 temporal tables?

半城伤御伤魂 提交于 2019-12-08 17:35:50
问题 I'm looking at SQL Server 2016 temporal tables and can't find any efficient way to query for all historical records that are now deleted. I prefer not to soft-delete or moving to a 'deleted items table', as I feel with temporal tables it is redundant. Can this can be achieved with temporal tables in an efficient way? 回答1: Temporal tables are intended to give you a point-in-time view of your data, not a state view - it doesn't actually understand state. Nothing is exposed to users to determine