author | Radek Brich <radek.brich@devl.cz> |
Tue, 19 Mar 2013 16:45:37 +0100 | |
changeset 78 | 64c62ac8f65d |
parent 22 | 680631f35d83 |
child 104 | d8ff52a0390f |
permissions | -rwxr-xr-x |
21 | 1 |
#!/usr/bin/env python3 |
2 |
||
3 |
import logging |
|
4 |
import time |
|
5 |
||
78
64c62ac8f65d
Rename config module to configparser.
Radek Brich <radek.brich@devl.cz>
parents:
22
diff
changeset
|
6 |
from tests.config import Config |
21 | 7 |
from pgtoolkit import pgmanager |
8 |
from pgtoolkit.delayedquery import DelayedQuery |
|
9 |
||
10 |
||
11 |
if __name__ == '__main__': |
|
12 |
cfg = Config('tests.conf') |
|
78
64c62ac8f65d
Rename config module to configparser.
Radek Brich <radek.brich@devl.cz>
parents:
22
diff
changeset
|
13 |
|
21 | 14 |
pgm = pgmanager.get_instance() |
15 |
pgm.create_conn(isolation_level = 'autocommit', **cfg) |
|
78
64c62ac8f65d
Rename config module to configparser.
Radek Brich <radek.brich@devl.cz>
parents:
22
diff
changeset
|
16 |
|
21 | 17 |
handler = logging.StreamHandler() |
18 |
logger = logging.getLogger('pgmanager') |
|
19 |
logger.addHandler(handler) |
|
20 |
logger.setLevel(logging.DEBUG) |
|
21 |
||
22 |
dq = DelayedQuery(pgm) |
|
78
64c62ac8f65d
Rename config module to configparser.
Radek Brich <radek.brich@devl.cz>
parents:
22
diff
changeset
|
23 |
|
21 | 24 |
print('add 1') |
25 |
dq.add(10, 'INSERT INTO test (name) VALUES (%s)', ['spam1'], queryid=1) |
|
26 |
dq.add(10, 'INSERT INTO test (name) VALUES (%s)', ['spam1'], queryid=1) |
|
27 |
print('after 1') |
|
78
64c62ac8f65d
Rename config module to configparser.
Radek Brich <radek.brich@devl.cz>
parents:
22
diff
changeset
|
28 |
|
21 | 29 |
time.sleep(5) |
78
64c62ac8f65d
Rename config module to configparser.
Radek Brich <radek.brich@devl.cz>
parents:
22
diff
changeset
|
30 |
|
21 | 31 |
print('add 2') |
32 |
dq.add(10, 'INSERT INTO test (name) VALUES (%s)', ['spam2']) |
|
78
64c62ac8f65d
Rename config module to configparser.
Radek Brich <radek.brich@devl.cz>
parents:
22
diff
changeset
|
33 |
|
21 | 34 |
time.sleep(5) |
35 |
print('after 10') |
|
36 |
||
37 |
time.sleep(10) |