gpt4 book ai didi

amazon-web-services - 由于破折号字符无法查询 Athena 表

转载 作者:行者123 更新时间:2023-12-04 17:15:15 25 4
gpt4 key购买 nike

我在 Athena 中有一个名为 fpa-dev 的表(由 Glue 创建)。当我运行这个简单的查询时:

SELECT * FROM 
fpa-dev
LIMIT 10

它给了我这个错误:

extraneous input '-' expecting {, '.', ',', 'add', 'as', 'all', 'some', 'any', 'where', 'group', 'order', 'having', 'limit', 'at', 'no', 'substring', 'position', 'tinyint', 'smallint', 'integer', 'date', 'time', 'timestamp', 'interval', 'year', 'month', 'day', 'hour', 'minute', 'second', 'zone', 'join', 'cross', 'inner', 'left', 'right', 'full', 'natural', 'filter', 'over', 'partition', 'range', 'rows', 'preceding', 'following', 'current', 'row', 'schema', 'comment', 'view', 'replace', 'grant', 'revoke', 'privileges', 'public', 'option', 'explain', 'analyze', 'format', 'type', 'text', 'graphviz', 'logical', 'distributed', 'validate', 'show', 'tables', 'views', 'schemas', 'catalogs', 'columns', 'column', 'use', 'partitions', 'functions', 'union', 'except', 'intersect', 'to', 'system', 'bernoulli', 'poissonized', 'tablesample', 'array', 'map', 'set', 'reset', 'session', 'data', 'start', 'transaction', 'commit', 'rollback', 'work', 'isolation', 'level', 'serializable', 'repeatable', 'committed', 'uncommitted', 'read', 'write', 'only', 'call', 'input', 'output', 'cascade', 'restrict', 'including', 'excluding', 'properties', 'nfd', 'nfc', 'nfkd', 'nfkc', 'if', 'nullif', 'coalesce', identifier, digit_identifier, quoted_identifier, backquoted_identifier} (service: amazonathena; status code: 400; error code: invalidrequestexception; request id: 1b9aaf21-a83f-4678-b2da-19994e11cfd7)



有什么方法可以查询带有“-”的表,还是必须重命名表?

最佳答案

您应该使用反引号来转义表名,就像使用任何保留字一样:

SELECT * FROM 
`fpa-dev`
LIMIT 10

关于amazon-web-services - 由于破折号字符无法查询 Athena 表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51604019/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com