Skip to content

Commit bf5ac4f

Browse files
committed
IGNITE-17054 Fix examples and documentation (#53)
1 parent ac12197 commit bf5ac4f

16 files changed

Lines changed: 550 additions & 846 deletions

docs/async_examples.rst

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ Firstly, import dependencies.
3232

3333
.. literalinclude:: ../examples/async_key_value.py
3434
:language: python
35-
:lines: 18
35+
:lines: 19
3636

3737
Let's connect to cluster and perform key-value queries.
3838

3939
.. literalinclude:: ../examples/async_key_value.py
4040
:language: python
4141
:dedent: 4
42-
:lines: 23-38
42+
:lines: 23-47
4343

4444
Scan
4545
====
@@ -49,7 +49,7 @@ that yields the resulting rows.
4949
.. literalinclude:: ../examples/async_key_value.py
5050
:language: python
5151
:dedent: 8
52-
:lines: 39-50
52+
:lines: 49-60
5353

5454
ExpiryPolicy
5555
============
@@ -63,20 +63,20 @@ in cache settings dictionary on creation.
6363
.. literalinclude:: ../examples/expiry_policy.py
6464
:language: python
6565
:dedent: 12
66-
:lines: 73-76
66+
:lines: 74-77
6767

6868
.. literalinclude:: ../examples/expiry_policy.py
6969
:language: python
7070
:dedent: 12
71-
:lines: 82-90
71+
:lines: 83-91
7272

7373
Secondly, expiry policy can be set for all cache operations, which are done under decorator. To create it use
7474
:py:meth:`~pyignite.cache.BaseCache.with_expire_policy`
7575

7676
.. literalinclude:: ../examples/expiry_policy.py
7777
:language: python
7878
:dedent: 12
79-
:lines: 97-106
79+
:lines: 98-107
8080

8181
Transactions
8282
------------
@@ -132,41 +132,44 @@ First let us establish a connection.
132132
.. literalinclude:: ../examples/async_sql.py
133133
:language: python
134134
:dedent: 4
135-
:lines: 197-198
135+
:lines: 24-25
136136

137137
Then create tables. Begin with `Country` table, than proceed with related
138138
tables `City` and `CountryLanguage`.
139139

140-
.. literalinclude:: ../examples/async_sql.py
140+
.. literalinclude:: ../examples/helpers/sql_helper.py
141141
:language: python
142-
:lines: 25-42, 51-59, 67-74
142+
:dedent: 4
143+
:lines: 27-43, 53-60, 68-74
143144

144145
.. literalinclude:: ../examples/async_sql.py
145146
:language: python
146147
:dedent: 4
147-
:lines: 199-205
148+
:lines: 27-32
148149

149150
Create indexes.
150151

151-
.. literalinclude:: ../examples/async_sql.py
152+
.. literalinclude:: ../examples/helpers/sql_helper.py
152153
:language: python
153-
:lines: 60-62, 75-77
154+
:dedent: 4
155+
:lines: 62, 76
154156

155157
.. literalinclude:: ../examples/async_sql.py
156158
:language: python
157159
:dedent: 8
158-
:lines: 207-209
160+
:lines: 35-36
159161

160162
Fill tables with data.
161163

162-
.. literalinclude:: ../examples/async_sql.py
164+
.. literalinclude:: ../examples/helpers/sql_helper.py
163165
:language: python
164-
:lines: 43-50, 63-66, 78-81
166+
:dedent: 4
167+
:lines: 45-51, 64-66, 78-80
165168

166169
.. literalinclude:: ../examples/async_sql.py
167170
:language: python
168171
:dedent: 8
169-
:lines: 212-223
172+
:lines: 39-49
170173

171174
Now let us answer some questions.
172175

@@ -176,7 +179,7 @@ What are the 10 largest cities in our data sample (population-wise)?
176179
.. literalinclude:: ../examples/async_sql.py
177180
:language: python
178181
:dedent: 8
179-
:lines: 225-243
182+
:lines: 52-66
180183

181184
The :py:meth:`~pyignite.aio_client.AioClient.sql` method returns :py:class:`~pyignite.cursors.AioSqlFieldsCursor`,
182185
that yields the resulting rows.
@@ -193,26 +196,27 @@ of :py:class:`~pyignite.cursors.AioSqlFieldsCursor`
193196
.. literalinclude:: ../examples/async_sql.py
194197
:language: python
195198
:dedent: 8
196-
:lines: 246-271
199+
:lines: 69-95
197200

198201
Display all the information about a given city
199202
==============================================
200203

201204
.. literalinclude:: ../examples/async_sql.py
202205
:language: python
203206
:dedent: 8
204-
:lines: 273-288
207+
:lines: 98-110
205208

206209
Finally, delete the tables used in this example with the following queries:
207210

208-
.. literalinclude:: ../examples/async_sql.py
211+
.. literalinclude:: ../examples/helpers/sql_helper.py
209212
:language: python
210-
:lines: 83
213+
:dedent: 4
214+
:lines: 82
211215

212216
.. literalinclude:: ../examples/async_sql.py
213217
:language: python
214218
:dedent: 8
215-
:lines: 290-297
219+
:lines: 113-115
216220

217221

218222

0 commit comments

Comments
 (0)