AQuickTutorial » History » Revision 3
Revision 2 (Aurynn Shaw, 11/20/2008 10:29 AM) → Revision 3/10 (Aurynn Shaw, 11/20/2008 01:37 PM)
= Simpycity in a Hurry = And what to expect when you use it. == Setup == First, set up Simpycity: {{{ from simpycity.core import Function from simpycity import config config.host = 'localhost' config.port = 5432 config.user = 'user' config.password = 'password' config.database = 'dbname' }}} Then, create some basic functions. {{{ f_all = Function("get_row",['id']) f = Function("get_rows") }}} '''f_all''' f_all maps to the stored procedure "get_rows", which takes no arguments. '''f''', f, on the other hand, maps to the stored procedure "get_row", which takes a single argument, which we've named id. To call f_all, it's a standard python function: {{{ all_results = f_all() }}} For get_row, it's the same Python call semantics, both positional and keyword arguments being supported {{{ result = f(1) # get id 1 result all_results = f(id=1) # also get id 1 f_all() }}}