AQuickTutorial » History » Version 2
Aurynn Shaw, 11/20/2008 10:29 AM
1 | 1 | Aurynn Shaw | = Simpycity in a Hurry = |
---|---|---|---|
2 | And what to expect when you use it. |
||
3 | |||
4 | == Setup == |
||
5 | |||
6 | First, set up Simpycity: |
||
7 | |||
8 | {{{ |
||
9 | 2 | Aurynn Shaw | from simpycity.core import Function |
10 | 1 | Aurynn Shaw | from simpycity import config |
11 | |||
12 | config.host = 'localhost' |
||
13 | config.port = 5432 |
||
14 | 2 | Aurynn Shaw | config.user = 'user' |
15 | config.password = 'password' |
||
16 | config.database = 'dbname' |
||
17 | |||
18 | }}} |
||
19 | |||
20 | Then, create some basic functions. |
||
21 | {{{ |
||
22 | f_all = Function("get_row",['id']) |
||
23 | f = Function("get_rows") |
||
24 | }}} |
||
25 | |||
26 | f_all maps to the stored procedure "get_rows", which takes no arguments. |
||
27 | |||
28 | f, on the other hand, maps to the stored procedure "get_row", which takes a single argument, which we've named id. |
||
29 | |||
30 | {{{ |
||
31 | result = f(1) |
||
32 | all_results = f_all() |
||
33 | 1 | Aurynn Shaw | }}} |