sassoftware / saspy

A Python interface module to the SAS System. It works with Linux, Windows, and Mainframe SAS as well as with SAS in Viya.
https://sassoftware.github.io/saspy
Other
373 stars 150 forks source link

Ability to specify the temp file of sd2df_DISK & sd2df_CSV using a parameter #330

Closed mtoma closed 3 years ago

mtoma commented 3 years ago

Is your feature request related to a problem? Please describe. I'm running saspy on a rather small VM connecting to a distant SAS server using IOM. The sd2df_DISK and sd2df_CSV methods are using the python tempfile module to create the temporary work files which in Linux will result in the /tmp/ folder. I don't have enoug space there to export the dataset (around 1GB in size).

Describe the solution you'd like It would be very usefull to be able to set the temps file explicitely overriding the default tempfile based method.

Describe alternatives you've considered My only alternative right now is to simlink the /tmp/ folder to filesystem with more space

Another possible workaround is setting this before saspy:

import os
os.environ["TMPDIR"] = '/usr/local/tmp'

Additional context CENTOS 7, SASPY+IOM

tomweber-sas commented 3 years ago

Hey Michal, both of those methods have a tempfile= and a tempkeep= parameter you can use to override the default of using the python temp location and the cleanup of the file. I can't do a direct link to that method in the doc, but if you navigate to sasdata2dataframe in the API section you'll see the following

Parameters: |

tempfile – [optional] an OS path for a file to use for the local file; default it a temporary file that’s cleaned up

tempkeep – if you specify your own file to use with tempfile=, this controls whether it’s cleaned up after using it

mtoma commented 3 years ago

Hi Tom, you are absolutely right! I completely missed the bottom part of the doc.

tomweber-sas commented 3 years ago

No problem Michal, I like these easy ones! haha