首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AWS卸载语句错误

AWS卸载语句错误
EN

Stack Overflow用户
提问于 2016-03-04 21:33:44
回答 1查看 328关注 0票数 1

我正在尝试运行下面的查询来完成从Redshift到S3的卸载,并且得到了一个没有帮助的错误。我们已经尝试过转义可能导致问题的所有字符,并且正在传递参数(包装程序使用Python):

代码语言:javascript
复制
unload ('select
            user_id
            ,course_id
            ,request_month
            ,user_agent_type
            ,count(session_id)
         from
                (select distinct
                    user_id
                    ,context_id as course_id
                    ,date_trunc(\'month\', request_timestamp) request_month
                    ,session_id
                    ,case
                    when user_agent like \'%CanvasAPI%\' then \'api\'
                    when user_agent like \'%candroid%\' then \'mobile_app_android\'
                    when user_agent like \'%iCanvas%\' then \'mobile_app_ios\'
                    when user_agent like \'%CanvasKit%\' then \'mobile_app_ios\'
                    when user_agent like \'%Windows NT%\' then \'desktop\'
                    when user_agent like \'%MacBook%\' then \'desktop\'
                    when user_agent like \'%iPhone%\' then \'mobile\'
                    when user_agent like \'%iPod Touch%\' then \'mobile\'
                    when user_agent like \'%iPad%\' then \'mobile\'
                    when user_agent like \'%iOS%\' then \'mobile\'
                    when user_agent like \'%CrOS%\' then \'desktop\'
                    when user_agent like \'%Android%\' then \'mobile\'
                    when user_agent like \'%Linux%\' then \'desktop\'
                    when user_agent like \'%Mac OS%\' then \'desktop\'
                    when user_agent like \'%Macintosh%\' then \'desktop\'
                    else \'other_unknown\'
                    end as user_agent_type
                from {}
                where context_type = \'Course\')
                group by
                    user_id
                    ,course_id
                    ,request_month
                    ,user_agent_type')
to {}
credentials 'aws_access_key_id={};aws_secret_access_key={}'
manifest
gzip
delimiter '|'

错误如下:

代码语言:javascript
复制
2016-03-04 14:28:12,208 [CRITICAL] - Error occurred during transaction: syntax error at or near "month"
LINE 12:     ,date_trunc('month', request_timestamp) request_month
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-03-04 21:44:40

您需要在request_month之前使用"as“这个词

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35806441

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档