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!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...