author | Radek Brich <brich.radek@ifortuna.cz> |
Tue, 29 Apr 2014 17:50:15 +0200 | |
changeset 98 | 024299702087 |
parent 78 | 64c62ac8f65d |
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) |