Skip to content

Commit

Permalink
Data type converter: Naming things
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Oct 18, 2022
1 parent 8085295 commit 1dc87ee
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/query.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ types. There is a default implementation for the CrateDB data types ``IP`` and

>>> from crate.client.converter import DefaultTypeConverter
>>> from crate.client.cursor import Cursor
>>> ccursor = connection.cursor(converter=DefaultTypeConverter())
>>> cursor = connection.cursor(converter=DefaultTypeConverter())

>>> ccursor.execute("SELECT datetime_tz, datetime_notz FROM locations ORDER BY name")
>>> cursor.execute("SELECT datetime_tz, datetime_notz FROM locations ORDER BY name")

>>> ccursor.fetchone()
>>> cursor.fetchone()
[datetime.datetime(2022, 7, 18, 18, 10, 36, 758000), datetime.datetime(2022, 7, 18, 18, 10, 36, 758000)]


Expand All @@ -238,11 +238,11 @@ converter function defined as ``lambda``, which assigns ``yes`` for boolean

>>> converter = Converter()
>>> converter.set(DataType.BOOLEAN, lambda value: value is True and "yes" or "no")
>>> ccursor = connection.cursor(converter=converter)
>>> cursor = connection.cursor(converter=converter)

>>> ccursor.execute("SELECT flag FROM locations ORDER BY name")
>>> cursor.execute("SELECT flag FROM locations ORDER BY name")

>>> ccursor.fetchone()
>>> cursor.fetchone()
['no']


Expand Down

0 comments on commit 1dc87ee

Please sign in to comment.