Splunk Dev

SQLite3をPythonスクリプト内で使用する

ts_splunk
Path Finder

ログイン認証のスクリプトやカスタムサーチコマンドのPythonスクリプト内でSQLiteを使用したいです。

import sqlite3

を記入してもsqlite3が見つからないと言われたため
C:\Program Files\Splunk\Python-2.7\Lib\に、別途Python2.7をインストールした環境から
\Lib\sqlite3フォルダをコピーして試しました。

import sqlite3

from dbapi2 import *

from _sqlite3 import *
とインポートするところでモジュールが見つからないと言われます。

_sqlite3.pydをsqlite3フォルダにコピーすると、少しエラーメッセージが変わりましたが
まだ色々と足りないようで、ImportErrorとなります。

WindowsのSplunk環境で、組み込みのPythonにおいてSQLite3を使用するにはどうしたらいいでしょうか?

Tags (3)
0 Karma

ts_splunk
Path Finder

Python.exeを入れ替えるとSQLiteが使用できました。
Splunk組み込みのPythonと、別途インストールしたPython2.7のPython.exeはバイナリサイズも少し異なるようですが、何が異なるのでしょうか?
Pythonのバージョンを確認すると同じビルド番号でした。

python.exe --version

Python.exeを差し替えたまま使用してもSplunkの動作には影響ないでしょうか?

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...