您的位置:首页技术文章
文章详情页

python - 使用pyhive 能够执行source 语句吗

【字号: 日期:2022-06-27 16:27:13浏览:34作者:猪猪

问题描述

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

标签: Python 编程
相关文章: