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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...