snowflake-cloud-data-platform - 雪花 : Execution error in store procedure : SQL compilation error: Object does not exist or not authorized. 在 Statement.execute

标签 snowflake-cloud-data-platform

我完全被 Snowflake 系统的权限模型弄糊涂了。我创建了一个数据库,在该数据库中创建了一个存储过程,并尝试使用 SYSADMIN 角色中的同一用户调用该存储过程。我收到错误“存储过程中的执行错误:SQL 编译错误:对象不存在或未授权。在 Statement.execute”

我什至不知道从哪里开始。我的用户怎么没有权限访问该用户创建的表?

Screenshot of procedure and error message

Second Screenshot w/ Database structure visible.

最佳答案

检查您所引用的对象名称的大小写。例如,如果您创建了用双引号括起来的表,则它区分大小写。 Snowflake 自动将未加引号的标识符转换为大写。

例子:

    CREATE TABLE test1 (
    test nvarchar)

    CREATE TABLE "teSt2" (
    test nvarchar)

   -- This works
    select * from test1

   -- This doesn't work because the table was created wrapped in double quotes and with a capital S in the name
    select * from test2

   -- This doesn't work either because it will convert to UPPER
    select * from teSt2

   -- This works
    select * from "teSt2"

关于snowflake-cloud-data-platform - 雪花 : Execution error in store procedure : SQL compilation error: Object does not exist or not authorized. 在 Statement.execute,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61377923/

相关文章:

cloud - 如何获取雪花中今天或之前的 n 天/月/年日期?

datetime - 如何比较雪花中我所看到的两个日期(不同时区)(我无法设置时区参数)?

包含许多 'AND NOT CONTAINS' 语句的 SQL 查询

python - Snowflake - 如何使用 NodeJS 连接到 Snowflake

snowflake-cloud-data-platform - 即使查询已缓存,NodeJS 连接器也会出现延迟

mysql - BCP CHAR 值转为雪花

javascript - 如何将表的列名存储在 Snowflake 的数组中

sql - Snowflake - 在使用窗框或订单时获取不同用户的计数

SQL:仅当行具有相同 ID 的值时才排除

snowflake-cloud-data-platform - 如何忽略雪花中的所有空白字符和标点符号