on 2019 Nov 26 8:23 AM
I use python and sqlalchemy but pd.read_ sql_ query is so slow so I try to write the data in csv file in my procedure with unload statment to cleint then i want to use pd.read_scv
UNLOAD TABLE #table INTO CLIENT FILE 'c:\\tmp\\test_data.csv;
i get error messages
'Client application does not allow data to be written to this file '
in pyhon code from sqlalchemy
Thanks for the help in advance
Request clarification before answering.
Try this: http://dcx.sap.com/index.html#sqla170/en/html/812c36fb6ce21014a20ae7873e5607d0.html
There are times when a callback is required though (such as when the UNLOAD is in a stored procedure) and you won't be able to do that from python, I don't think. See DB_CALLBACK_VALIDATE_FILE_TRANSFER at http://dcx.sap.com/index.html#sqla170/en/html/3bd12e6c6c5f1014b9d2d85be55df0a4.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks, I also tried 'SET Temporary OPTION allow_write_client_file =' On ';' the message from interactive sql is: "has a procedure or trigger calls to write in file allow this transfer refuse this exaggeration " and in paython code The client application does not allow the transmission of data initiated by the server. To allow the transmission of data initiated by the server, the application must register a validation callback mechanism in the client library.
The point is you need to register the callback (which seems not to be possible with SQL Anywhere's Python support) when the client read is initiated by the server, see the doc topic cited by John:
For data security, the server tracks the origin of statements requesting a file transfer. The server determines if the statement was received directly from the client application. When initiating the transfer of data from the client, the server sends the information about the origin of the statement to the client software. On its part, the Embedded SQL client library allows unconditional transfer of data only if the data transfer is being requested due to the execution of a statement sent directly by the client application. Otherwise, the application must have registered the validation callback described above, in the absence of which the transfer is denied and the statement fails with an error. If the client statement invokes a stored procedure already existing in the database, then the execution of the stored procedure itself is considered not to have been for a client initiated statement. However, if the client application explicitly creates a temporary stored procedure then the execution of the stored procedure results in the server treating the procedure as having been client initiated. Similarly, if the client application executes a batch statement, then the execution of the batch statement is considered as being done directly by the client application.
In other words: A simple UNLOAD statement (like the sample shown in your question) issued by the client should not require a registered callback and as such should work from Python. At least that's my understanding.
User | Count |
---|---|
52 | |
8 | |
5 | |
5 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.