python - 使用pyhive 能够执行source 语句吗
问题描述
cursor.execute('source ’/home/hadoop/create_table.sql’')执行结果
OperationalError: TExecuteStatementResp(status=TStatus(infoMessages=['*org.apache.hive.service.cli.HiveSQLException:Error while compiling statement: FAILED: ParseException line 1:0 cannot recognize input near ’source’ ’/’ ’home’:28:27', ’org.apache.hive.service.cli.operation.Operation:toSQLException:Operation.java:388’, ’org.apache.hive.service.cli.operation.SQLOperation:prepare:SQLOperation.java:193’, ’org.apache.hive.service.cli.operation.SQLOperation:runInternal:SQLOperation.java:276’, ’org.apache.hive.service.cli.operation.Operation:run:Operation.java:324’, ’org.apache.hive.service.cli.session.HiveSessionImpl:executeStatementInternal:HiveSessionImpl.java:499’, ’org.apache.hive.service.cli.session.HiveSessionImpl:executeStatement:HiveSessionImpl.java:475’, ’sun.reflect.GeneratedMethodAccessor10:invoke::-1’, ’sun.reflect.DelegatingMethodAccessorImpl:invoke:DelegatingMethodAccessorImpl.java:43’, ’java.lang.reflect.Method:invoke:Method.java:498’, ’org.apache.hive.service.cli.session.HiveSessionProxy:invoke:HiveSessionProxy.java:78’, ’org.apache.hive.service.cli.session.HiveSessionProxy:access$000:HiveSessionProxy.java:36’, ’org.apache.hive.service.cli.session.HiveSessionProxy$1:run:HiveSessionProxy.java:63’, ’java.security.AccessController:doPrivileged:AccessController.java:-2’, ’javax.security.auth.Subject:doAs:Subject.java:422’, ’org.apache.hadoop.security.UserGroupInformation:doAs:UserGroupInformation.java:1548’, ’org.apache.hive.service.cli.session.HiveSessionProxy:invoke:HiveSessionProxy.java:59’, ’com.sun.proxy.$Proxy34:executeStatement::-1’, ’org.apache.hive.service.cli.CLIService:executeStatement:CLIService.java:270’, ’org.apache.hive.service.cli.thrift.ThriftCLIService:ExecuteStatement:ThriftCLIService.java:507’, ’org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement:getResult:TCLIService.java:1437’, ’org.apache.hive.service.rpc.thrift.TCLIService$Processor$ExecuteStatement:getResult:TCLIService.java:1422’, ’org.apache.thrift.ProcessFunction:process:ProcessFunction.java:39’, ’org.apache.thrift.TBaseProcessor:process:TBaseProcessor.java:39’, ’org.apache.hive.service.auth.TSetIpAddressProcessor:process:TSetIpAddressProcessor.java:56’, ’org.apache.thrift.server.TThreadPoolServer$WorkerProcess:run:TThreadPoolServer.java:286’, ’java.util.concurrent.ThreadPoolExecutor:runWorker:ThreadPoolExecutor.java:1142’, ’java.util.concurrent.ThreadPoolExecutor$Worker:run:ThreadPoolExecutor.java:617’, ’java.lang.Thread:run:Thread.java:748’, '*org.apache.hadoop.hive.ql.parse.ParseException:line 1:0 cannot recognize input near ’source’ ’/’ ’home’:32:5', ’org.apache.hadoop.hive.ql.parse.ParseDriver:parse:ParseDriver.java:207’, ’org.apache.hadoop.hive.ql.parse.ParseDriver:parse:ParseDriver.java:166’, ’org.apache.hadoop.hive.ql.Driver:compile:Driver.java:444’, ’org.apache.hadoop.hive.ql.Driver:compileInternal:Driver.java:1242’, ’org.apache.hadoop.hive.ql.Driver:compileAndRespond:Driver.java:1229’, ’org.apache.hive.service.cli.operation.SQLOperation:prepare:SQLOperation.java:191’], statusCode=3, sqlState=’42000’, errorMessage='Error while compiling statement: FAILED: ParseException line 1:0 cannot recognize input near ’source’ ’/’ ’home’', errorCode=40000), operationHandle=None)
以上报错
问题解答
回答1:source /home/hadoop/create_table.sql
相关文章:
1. html5 - 百度Ueditor代码高亮和代码段滚动条冲突是怎么回事?2. javascript - 静态页面引公共头尾文件,js怎么写吖?3. docker gitlab 如何git clone?4. javascript - 读取页面源码,页面中所有的换行都被当成<br/>读取出来 了,,求解应该怎么让它被正确的解析5. javascript - 关于一段 for 循环代码执行顺序的问题6. docker网络端口映射,没有方便点的操作方法么?7. javascript - vue 数据更新了。但是dom没有更新,,,,,如图8. java - 3个dao的数据根据请求参数选择一个映射到一个url上,怎么写比较好?9. docker 17.03 怎么配置 registry mirror ?10. 如何调整IDEA中直接运行java程序的日志输出级别?