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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

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