如何强制雪花用户使用列值(例如日期/时间戳)从表中过滤结果?
在讨论如何停止雪花用户运行select
在表上,我们得到了一个<一个href =“ https://twitter.com/rahulj51/status/15449427654774333345” rel =“ noreferrer”>相关问题日期/时间戳列“
那么,我如何在查询表格时强迫雪花用户使用一系列日期?
When discussing how to stop Snowflake users from running select *
on a table, we got a related question: "If only there was a way to do something similar to enforce a where clause on the date/timestamp column"
So how I can force Snowflake users to use a range of dates when querying a table?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决此问题的一种方法是创建一个视图在桌子上。此视图的第一行应该充满无效的计算,并且日期/时间戳在正常日期之外:
现在,每当有人查询视图时,每当他们不过滤不合适的日期时,它都会丢弃描述性错误:
< a href =“ https://i.sstatic.net/jyjob.png” rel =“ nofollow noreferrer”>
请注意,使用
Secure>安全视图
,我们可以管理权限,以便分析师可以以便可以使分析师可以可以仅通过视图获取数据,而无需让它们访问基础表。额外的学分:
One way to solve this is to create a view over the table. The first row of this view should be full of invalid computations, and a date/timestamp outside the normal range of dates:
Now whenever someone queries that view, it will throw a descriptive error whenever they don't filter out the inappropriate date:
Note that with a
secure view
we can manage permissions so analysts can only get data through the view, without giving them access to the underlying table.Extra credits:
一个更清洁的替代方案(如
然后,您可以使用
select *从table(function_name(function_name)(function_name(直到))
:A cleaner alternative (as suggested on reddit): Create a SQL table function requiring the filtering parameters, and then returns the filtered table:
Then you can use it with
select * from table(function_name(since, until))
: