def set_server_fields(table, *fields): ''' Specify which fields are defined by the database, i.e. autoincremental fields, fields with defaults, fields automatically set by a trigger. ''' table._ifields = tuple(f for f in table._fields if not f in fields) table._insert = sql.insert(table) table._create = sql.create(table)
def test_create(): raw = sql.create(client).templ.raw assert_equal( raw, '''INSERT INTO client (client_id, description) SELECT * FROM (SELECT %s, %s) AS vals WHERE NOT EXISTS (SELECT 1 FROM client WHERE client_id=%s)''')