简体   繁体   English

带引号的sql查询中的奇怪符号错误

[英]Strange symbol error in sql query with quotation marks

I have a sql query in my R code:我的 R 代码中有一个 sql 查询:

 query <- glue("SELECT
    oper.value
    oper.status
    oper.class
 FROM "uploads".ratings AS rates"

But i get this error:但我收到此错误:

Error: unexpected symbol in:
"oper.class
 FROM "uploads"

How could i handle it?我怎么办? How should i write schema part in query?我应该如何在查询中编写架构部分?

It seems that r interprets the double quotes character as the end of the string.似乎 r 将双引号字符解释为字符串的结尾。 You would need to use an escape character to your query.您需要在查询中使用转义字符

I think this should do it :我认为这应该这样做:

query <- glue("SELECT
    oper.value
    oper.status
    oper.class
FROM \"uploads\".ratings AS rates")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM