Skip to content

Commit e06c30d

Browse files
authored
[HZ-5259] Fixed sql_async_example.py (#765)
`sql_async_example.py` exits too early, before having a change to print the result rows. Added a small sleep to make sure the rows are printed before exit.
1 parent 432508c commit e06c30d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

examples/sql/sql_async_example.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# for the capabilities of the SQL service. The code sample here is just to
44
# demonstrate the concept of async usage of the SQL service. When in doubt,
55
# use the blocking iterator method in `sql_example.py`.
6+
import time
7+
68
import hazelcast
79

810
client = hazelcast.HazelcastClient()
@@ -15,7 +17,7 @@
1517
# Create mapping for the integers. This needs to be done only once per map.
1618
client.sql.execute(
1719
"""
18-
CREATE MAPPING integers
20+
CREATE OR REPLACE MAPPING integers
1921
TYPE IMap
2022
OPTIONS (
2123
'keyFormat' = 'int',
@@ -49,3 +51,4 @@ def on_next_row(row_future):
4951
# Request the iterator over rows and add a callback to
5052
# run, when the response comes
5153
result_future.add_done_callback(on_response)
54+
time.sleep(1)

0 commit comments

Comments
 (0)