<jupyter_start><jupyter_text>Init<jupyter_code>cd c:\Workspace\Jupyter\plastic<jupyter_output>c:\Workspace\Jupyter\plastic<jupyter_text>MySQL<jupyter_code>from plastic.connectors.mysql import PlasticMysql
class Task(PlasticMysql): pass
Task.find(Task.id[3:])<jupyter_output><empty_output><jupyter_text>Quickstart (SQLite)File-based testing (as used in the committed entry)  Get some data out<jupyter_code>from plastic.connectors.sqlite import PlasticSqlite
PlasticSqlite._dbInfo = './dev/sqlite-test.db'
class Task(PlasticSqlite): pass
Task.find(Task.id[3:])<jupyter_output><empty_output><jupyter_text>Change a record<jupyter_code>task = Task(id=4)
task
task.title = "A bit more interesting"
task._commit()
Task(id=4)<jupyter_output><empty_output><jupyter_text>Find and filter<jupyter_code>print({task.title: task.description 
       for task 
       in Task.find(Task.active[0])})<jupyter_output>{'Skipped': None, 'A bit more interesting': 'Not much to say here.'}<jupyter_text>Add an entry<jupyter_code>newTask = Task()
newTask.title = "A new task to do"
newTask.active = True
newTask._commit()
Task.find(Task.id[5:]) # get tasks after the last added<jupyter_output><empty_output><jupyter_text>SQLiteIn-memory testing<jupyter_code>from plastic.connectors.sqlite import PlasticSqlite, Sqlite_Connector
PlasticSqlite._connection = Sqlite_Connector()
with open('./test/plastic/connectors/sqlite.base.sql') as rawsql:
    statements = rawsql.read().split(';')
    for statement in statements:
        PlasticSqlite._connection._execute_query(statement, [])
class Task(PlasticSqlite):
    _connection = PlasticSqlite._connection
    pass
Task._pending
t = Task(id=2)
Task._pending
Task.find(Task.id[1:])
Task.find(Task.id[7])
t7 = Task(active=1, title="New Task")
t7._pending
t7._commit()
t7._pending
Task.find(Task.id[1:])<jupyter_output><empty_output>