KDB将一个表格复制一个表格(meta)到另一个表格

发布于 2025-01-24 17:44:03 字数 318 浏览 0 评论 0原文

我正在尝试将一个表的模式映射到另一个表格,

例如,我有t1t2,它们具有精确的列名和顺序,但数据类型不同,但是我想要(META T2)〜META T1。 // 1B

我的想法是使用t1使用meta的数据类型字符串,说是“ sffffffjjj”。然后将T2存储到.csv,并使用“ sffffffjjj”读取它。这起作用,但不聪明,有人能提出更好的想法吗?

I'm trying to map one table's schema to another table,

For instance, I have t1 and t2, which have exact column names and order but different datatype, but I want (meta t2)~meta t1. //1b.

My idea is to copy datatype string of t1 using meta, say it's "SFFFFFJJJ". Then store t2 to .csv and read it with "SFFFFFJJJ". This works but not smart, could anyone come up with better ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

弱骨蛰伏 2025-01-31 17:44:03

您可以使用一个表的元表铸出另一个表:

t2:flip(frof from Meta t1)$ string flip flip t2

You could use the meta of one table to cast the other table:

t2:flip(exec upper t from meta t1)$string flip t2

﹉夏雨初晴づ 2025-01-31 17:44:03

这是基于与您提到的相同原则的基础,而无需保存CSV形式的表:

{(upper (0!meta y)`t;enlist",")0:","0:x}[t1;t2]

这将返回表t1,但使用t2的架构。

在这里,“,”,“ 0:x准备文本将表转换为字符串列表,并由逗号界定数据。 (...; ...)0:加载csv 在提供类型的地方t2的元表。

This is based on the same principle as you mention, without the need to save the csv-formatted table:

{(upper (0!meta y)`t;enlist",")0:","0:x}[t1;t2]

This will return the table t1 but with the schema of t2.

Here, ","0:x is Prepare Text which converts the table into a list of strings, with data delimited by commas. The (...;...)0: is Load CSV where the types are being supplied t2's meta table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文