Python reading SBFspot.db SQLite database

Nov 7, 2015 at 6:42 AM
I'm trying to read data from the SBFspot.db SQLite database.
I use Python 2.7.9 and and the python sqlite3 library.
After a "select Power from DayData" query on windows I get the error:
"DatabaseError: file is encrypted or is not a database"
on the raspberry ( wheezy):
"sqlite3.OperationalError: no such table: DayData".

Anyone experience with Python and the SBFspot.db database?

Following is the python code
The version line works OK

import sqlite3 as SQL
con_sbf = SQL.connect('SBFspot.db')
cur_sbf = con_sbf.cursor()
cur_sbf.execute('SELECT SQLITE_VERSION()')
data = cur_sbf.fetchone()

print "SQLite version: %s" % data

cur_sbf.execute(''' select Power from DayData ;''' )

matrix= cur_sbf.fetchall()
print matrix[0][0]

Nov 7, 2015 at 8:40 AM
First of all, that name of the table is "vwDayData" if you haven't altered it. Second, do you have the right path to the database file SBFspot.db ?
Nov 7, 2015 at 8:48 AM
Use the absolute path to the db (/home/pi/smadata/SBFspot.db)
DayData table name is OK, vwDayData is a view to convert the datetime to local time
Nov 7, 2015 at 9:24 AM
See that now that there is a DayData table too, sorry my bad!