maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   rtcom-eventlogger and sqlite3 question (https://talk.maemo.org/showthread.php?t=43481)

omeriko9 2010-02-05 15:26

rtcom-eventlogger and sqlite3 question
 
Hi,

A few questions I couldn't find much info about in the wiki nor google:

1.How can I access the eventlogger from Python?

I've found this API reference:
http://maemo.org/api_refs/5.0/5.0-final/eventlogger/

and this Python code example to access Maemo API's without binding:
http://wiki.maemo.org/PyMaemo/Access...ython_bindings

But I can't seem to bind these two into a working code.

A code example would be wonderful.

2. I don't know how to view a DB schema in sqlite3 - I can use ".databases" to view all DB (can see "0 main" and "1 temp") but no knowledge on how to view it's schema (".schema" command is supposed to be followed by a table name, and since I don't know the tables names...)?

3. Are the event logger data kept in the some sqlite3 file?

kovach 2010-02-05 16:06

Re: rtcom-eventlogger and sqlite3 question
 
1. No python binding yet, just use sqlite3
2. .tables
3. /home/user/.rtcom-eventlogger/el.db

Here is some sample python code:

Code:

import sqlite3
EL_PATH = "/home/user/.rtcom-eventlogger/el.db"
conn = sqlite3.connect(EL_PATH)
cur = conn.cursor()
cur.execute("select event_type_id, start_time, E.remote_uid, remote_name from Events E, Remotes R " +
                        "where R.remote_uid=E.remote_uid and E.local_uid=R.local_uid and service_id = 1 " +
                        "order by start_time desc")

for datarow in cur:
        //do something with datarow[0], datarow[1] etc..


omeriko9 2010-02-05 16:31

Re: rtcom-eventlogger and sqlite3 question
 
Thank you very much!


All times are GMT. The time now is 07:50.

vBulletin® Version 3.8.8