@@ -49,10 +49,9 @@ Insert a new location::
49
49
>>> session.add(location)
50
50
>>> session.flush()
51
51
52
- Currently refresh option is missing, therefore sleep for now: :
52
+ Refresh "locations" table :
53
53
54
- >>> from time import sleep
55
- >>> sleep(1)
54
+ >>> _ = connection.execute("REFRESH TABLE locations")
56
55
57
56
Inserted location is available::
58
57
@@ -106,7 +105,10 @@ The datetime and date can be set using a update statement::
106
105
>>> location.nullable_date = datetime.today()
107
106
>>> location.nullable_datetime = datetime.utcnow()
108
107
>>> session.flush()
109
- >>> sleep(1.1) # wait for index refresh
108
+
109
+ Refresh "locations" table:
110
+
111
+ >>> _ = connection.execute("REFRESH TABLE locations")
110
112
111
113
Boolean values get set natively::
112
114
@@ -140,7 +142,11 @@ Update multiple Locations::
140
142
... session.add(loc)
141
143
... session.flush()
142
144
143
- >>> sleep(2) # give crate some time to settle
145
+ Refresh "locations" table:
146
+
147
+ >>> _ = connection.execute("REFRESH TABLE locations")
148
+
149
+ Query database:
144
150
145
151
>>> result = connection.execute("update locations set flag=true where kind='Update'")
146
152
>>> result.rowcount
@@ -154,7 +160,10 @@ documents in the table::
154
160
True
155
161
156
162
>>> session.commit()
157
- >>> sleep(2) # give crate some time to settle
163
+
164
+ Refresh "locations" table:
165
+
166
+ >>> _ = connection.execute("REFRESH TABLE locations")
158
167
159
168
Test that objects can be used as list too::
160
169
@@ -202,7 +211,10 @@ test updated nested dict::
202
211
>>> char.details['name']['first'] = 'Trillian'
203
212
>>> char.details['size'] = 45
204
213
>>> session.commit()
205
- >>> sleep(1.1) # wait for index refresh
214
+
215
+ Refresh "characters" table:
216
+
217
+ >>> _ = connection.execute("REFRESH TABLE characters")
206
218
207
219
>>> session.refresh(char)
208
220
>>> import pprint
0 commit comments