问题标签 [temporal-database]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
sql - 如何通过保留数据将存在表更改为 SQL 临时表?
我有很多数据表,我想将其转换为 Microsoft 临时表,但是当我想转换临时表时会导致我的数据丢失。我的代码是:
如何通过保留数据将存在表更改为 Sql 时态表?
c# - 实体框架不使用时态表
我正在使用数据库优先实体框架 6。将架构中的一些表更改为临时表后,尝试插入新数据时开始出现以下错误:
Cannot insert an explicit value into a GENERATED ALWAYS column in table '<MyDatabase>.dbo.<MyTableName>. Use INSERT with a column list to exclude the GENERATED ALWAYS column, or insert a DEFAULT into GENERATED ALWAYS column.
看起来 EF 正在尝试更新PERIOD
由系统管理的列的值。
从 EDMX 文件中删除列似乎可以解决问题,但这不是一个可行的解决方案,因为每次从数据库重新生成模型时都会重新添加列。
sql - SQL Server 2012:是否可以免除某些列触发历史表更新?
我创建了一个数据库来跟踪我公司的计算机。目标是每晚自动更新数据并在历史记录表中跟踪任何更改。我创建了一个临时表,一切似乎都运行良好。但是,我想为每个计算机帐户从 AD 中免除包含 lastLogon 的列。数据的历史无关紧要,它会导致对历史表进行许多不必要的更新,我担心它会增长得太快。有没有办法做类似“更新历史表以更改除 m_lastLogon 之外的任何列”?
sql-server - 将表值函数用于 EF6 对时间查询的支持?
此链接描述了如何将 TVF 与 EF6 Database First 一起使用,以便它们可以像 SQL 表的实体一样在 Linq 查询中使用。
似乎可以创建一个 TVF,从 SQL 时态表中查询历史数据,然后将其提供给 Linq 查询。
例如,TVF 可能有这样的代码来获取它的结果集
我看到的唯一问题是每次有人重新生成 EDMX 时都必须重新映射 TVF。
有没有办法使用 T4 自动将 TVF 映射到 Child 表?
architecture - How to perform temporal queries against event sources using Apache Kafka?
We are using Apache Kafka as an event sourcing mechanism for efficiently distributing events to multiple repositories to build an application state based on the use case of the services that will serve the data. As an example, say we have Service A and Service B. Service A and Service B both have a repository of the same people, but the view of the data is different based on use case. The idea being that as we will need new views of the data for separate use cases, we can replay the event stream into a new or existing repository. This is based on the idea outlined here and here regarding stream processing and event sourcing with rebuilding Application State from events..
As part of our business model, we may process frequent changes against those people (e.g. Names, addresses, and dates change somewhat frequently). One new use case that has come up is that we may need to perform a temporal query (i.e. Show me what the person's data looked like at a specific date and time). The obvious answer to that is to replay all of the events up to a specific moment in time to rebuild Application State. While this sounds reasonable on paper, I think this doesn't scale well when you potentially have billions of events over the course of years.
Current Solution Today, the general concept is that our Kafka consumers will process these events from a single topic based on activity (e.g. Address updates, Name Updates, etc) and update a master copy of the person data to what they should look like "right now", and then store a copy of the delta of the change in a separate store which is keyed appropriately so that we can relate changes to a specific person. Ideally, we are thinking a key/value store (NoSQL) is the right store for this data. The approach is to use this store to replay all of the deltas for a person to get serve that temporal query need.
The Ask Is this approach correct for building out stores for temporal queries of data? Are there other approaches or even tools that have solved this need when dealing with massive amounts of data? Kafka seems correct for the event sourcing part of the equation, but my concern exists around needing to maintain events for years for the purposes of auditing, disaster recovery, and temporal (point in time) queries.
c# - 使用 C# Entity Framework 在时态表中插入记录
我在Temporal table
使用 C# 实体框架插入数据时遇到问题
表架构是
我创建了一个 EDMX asusal 并尝试使用以下 C# 代码插入记录
我在使用时遇到了异常db.SaveChanges()
“无法将显式值插入到表 'DevDB.dbo.People' 的 GENERATED ALWAYS 列中。将 INSERT 与列列表一起使用以排除 GENERATED ALWAYS 列,或将 DEFAULT 插入 GENERATED ALWAYS 列。”
我尝试使用 SQL Server 使用以下插入查询直接插入,它的插入很好。
请帮助我如何使用 C# Entity Framework 插入记录。
sql-server - 为什么 FOR 子句不适用于带有临时表的 SQL Server 2016 中的别名?
我有一个带有时态表的 SQL Server 2016 数据库。一张临时表称为公司。我正在尝试查询它以获取当前记录和所有历史记录。我首先尝试了以下查询:
并得到以下错误: “FOR”附近的语法不正确。
但是,如果我在没有别名的情况下尝试它,它可以正常工作:
我找不到任何关于此的文档 - 它是合法的约束、已知问题还是其他什么?
sql - SQL Server 2016 - 手动设置期间开始和结束日期时间
我正在尝试加载一些基于时间的历史数据,我希望它位于 SQL Server 2016 的时态表中。
据我所知,不能手动设置期间开始和结束日期,它们是使用系统时间在插入/更新/删除时间设置的。
但是,我尝试加载的文件具有数据可用的特定日期,我希望将其反映在期间开始日期中,以便我可以相应地查询它。
有没有办法手动设置期间的开始和结束时间?
postgresql - postgresql 枚举时间
我想为使用此查询的枚举添加值:
我的主表是成功的,但是当我尝试这个查询时:
对于我的临时表: https ://wiki.postgresql.org/wiki/SQL2011Temporal
我有这个错误信息:
他将我的 M 修改为 m。
当我尝试:
我有这个错误:
如何将枚举添加到临时表?