I'm trying to make a quick file upload to a table via python on SAP IQ. Faced such a problem. Initially, the user has access to download files using load table (...) using client file ...
instruction. If you use the software from SAP (interactive sql) everything works fine, but using the sqlanydb library I get an error ... (b'Operation failed on file due to file permissions.) File: file.txt \ n-- (oslib / hos_clientfileio.cxx 143 ) '
, -1006148). Help please understand, what exactly am I doing wrong? Probably it is necessary to add some parameter in sqlanydb.connect ()
, but i could not find the normal documentation. I can not use import
or insert
, because files can getting larger in the future (from 100K lines and more). So load table (...) using client file
instruction has very quickly uploading data and practically makes no effort on server.
My code:
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()
I'm ready to use any idea, maybe there are other libraries that will make this possible using python