splunk / splunk-sdk-python

Splunk Software Development Kit for Python
http://dev.splunk.com
Apache License 2.0
687 stars 369 forks source link

Not able to import DataBases #120

Closed Siddharth-Chandran closed 8 years ago

Siddharth-Chandran commented 8 years ago

Am not able to import database libraries such as MySQLdb or SQLite in python scripts that is run using Splunk SDK or scripts run by Splunk during alerts.

shakeelmohamed commented 8 years ago

Hi @Siddharth-Chandran,

Splunk ships with it's own version of Python, and those packages aren't bundled with it (see: $SPLUNK_HOME/lib/python2.7/site-packages). One work around is installing the packages directly on the Splunk instance, like so:

sudo pip install --ignore-installed --target="$SPLUNK_HOME/lib/python2.7/site-packages" package-name
itay commented 8 years ago

@Siddharth-Chandran to add to what @shakeelmohamed is saying, take into account that we do not guarantee any compatibility with other libraries beyond the ones we ship for our Python runtime, and it may break with an upgrade. If you need to use libraries that are usually packaged (e.g. the DB drivers), your best bet is to shell out to the system Python.

I'm going to close this ticket as this isn't an SDK issue. If you want to follow up on this, the best place to do so is at support@splunk.com so they can properly track your request.