File: ex_01_table_movie.py

package info (click to toggle)
sqlkit 0.9.5-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 8,184 kB
  • sloc: python: 17,477; sql: 166; makefile: 95; xml: 23; sh: 11
file content (31 lines) | stat: -rw-r--r-- 857 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""base/base import

these are the base import. All other examples skip the imports that are
granted by the way execfile is done in 'demo.py'.

The proxy is not strictly needed, it's just a way to pass metadata and session 
in a single argument

Table
-----
base editing mode: table view
When the first argument is a string, it triggets the reflection of the table
from the database. in this case the image is just rendered as string. Following
examples show how to change this.

NOT NULL fields are rendered with columns with italic font

Right-click on the record to see what you can do: delete, add a new record or
display the record in a Mask
"""

from sqlkit.widgets import SqlTable
from sqlkit.db import proxy
import model

db = proxy.DbProxy(bind="sqlite:///%s" % model.DB_FILE)


t = SqlTable('movie',    dbproxy=db, order_by='title', )
t.reload()