我正在尝试通过 SAP IQ 上的 python 将文件快速上传到表中。遇到这样的问题。最初,用户有权使用 load table (...) using client file ...
指令下载文件。如果您使用 SAP(交互式 sql)中的软件,一切正常,但使用 sqlanydb 库我会收到错误... (b'Operation failed on file due to file permissions.) File: file.txt \ n-- (oslib / hos_clientfileio.cxx 143 ) '
,-1006148)。帮助请理解,我到底做错了什么?可能有必要在 中添加一些参数sqlanydb.connect ()
,但我找不到正常的文档。我不能使用import
or insert
,因为将来文件可能会变得更大(从 100K 行或更多)。所以load table (...) using client file
指令上传数据非常快,几乎不需要服务器。我的代码:
import sqlanydb
conne = sqlanydb.connect(uid='user',
pwd='password',
databasename = 'dbname',
host = 'host.name')
_SQL = '''create table #REP001 (
col1 int,
col2 int
)
;
commit;
load table #REP001
(
col1 ';',
col2 '\x0d\x0a'
)
using client file 'file.txt'
quotes off
escapes off
;
commit;'''
cur = conne.cursor()
cur.execute(_SQL)
cur.close()
conne.close()
我准备好使用任何想法,也许还有其他库可以使用 python 实现这一点