8000 docs: add a querying example into the main readme (#515) · FirePing32/python-spanner-django@c477cc2 · GitHub
[go: up one dir, main page]

Skip to content

Commit c477cc2

Browse files
Ilya Gurovmf2199
andauthored
docs: add a querying example into the main readme (googleapis#515)
* docs: add a querying example into the main readme * Update README.rst * Update README.rst Co-authored-by: MF2199 <38331387+mf2199@users.noreply.github.com>
1 parent 72096f5 commit c477cc2

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

README.rst

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,8 @@ Format
7474
},
7575
}
7676
77-
Example
78-
~~~~~~~
79-
80-
For example:
77+
Database configurations
78+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8179

8280
.. code:: python
8381
@@ -90,6 +88,25 @@ For example:
9088
}
9189
}
9290
91+
Execute a query
92+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93+
94+
.. code:: python
95+
96+
from google.cloud.spanner_dbapi import connect
97+
98+
connection = connect("instance-id", "database-id")
99+
cursor = connection.cursor()
100+
101+
cursor.execute(
102+
"SELECT *"
103+
"FROM Singers"
104+
"WHERE SingerId = 15"
105+
)
106+
107+
results = cur.fetchall()
108+
109+
93110
Limitations
94111
-----------
95112

0 commit comments

Comments
 (0)
0