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!

Why You Can't Miss .conf25: Unleashing the Power of Agentic AI with Splunk & Cisco

The Defining Technology Movement of Our Lifetime The advent of agentic AI is arguably the defining technology ...

Deep Dive into Federated Analytics: Unlocking the Full Power of Your Security Data

In today’s complex digital landscape, security teams face increasing pressure to protect sprawling data across ...

Your summer travels continue with new course releases

Summer in the Northern hemisphere is in full swing, and is often a time to travel and explore. If your summer ...