Skip to content

Commit

Permalink
adding sqlite example
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrogers committed Nov 8, 2023
1 parent 99eaa45 commit f0f626f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
30 changes: 30 additions & 0 deletions examples/theater/SQLiteDatabaseReader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import pycinema
import pycinema.filters
import pycinema.theater
import pycinema.theater.views

# pycinema settings
PYCINEMA = { 'VERSION' : '2.0.0'}

# layout
vf0 = pycinema.theater.Theater.instance.centralWidget()
vf0.setHorizontalOrientation()
vf0.insertView( 0, pycinema.theater.views.NodeEditorView() )
ImageView_0 = vf0.insertView( 1, pycinema.theater.views.ImageView() )
vf0.setSizes([703, 701])

# filters
SqliteDatabaseReader_0 = pycinema.filters.SqliteDatabaseReader()
ImageReader_0 = pycinema.filters.ImageReader()

# properties
SqliteDatabaseReader_0.inputs.path.set("data/wildfire/wildfire.sqlite3", False)
SqliteDatabaseReader_0.inputs.table.set("vision", False)
SqliteDatabaseReader_0.inputs.file_column.set("FILE", False)
ImageReader_0.inputs.table.set(SqliteDatabaseReader_0.outputs.table, False)
ImageReader_0.inputs.file_column.set("FILE", False)
ImageReader_0.inputs.cache.set(True, False)
ImageView_0.inputs.images.set(ImageReader_0.outputs.images, False)

# execute pipeline
SqliteDatabaseReader_0.update()
4 changes: 2 additions & 2 deletions pycinema/filters/SqliteDatabaseReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ def _update(self):
cnames = [entry[1] for entry in cdata]
table.append(cnames)

print(table)
# print(table)
# capture row data
data = cursor.execute("SELECT * FROM " + tname + "").fetchall() #LIMIT 10
for row in data:
# tuple output convert to list
table.append(list(row))

print(table)
# print(table)
cursor.close()
except sqlite3.Error as error:
print("Error while connecting to sqlite", error)
Expand Down

0 comments on commit f0f626f

Please sign in to comment.