to_sql()

Convert a Python value to its SQL string representation.

Usage

Source

to_sql(value)

Parameters

value: Any
The value to convert.

Returns

str
The SQL string representation of the value. Booleans become 1 or 0, and single quotes in strings are doubled.

Examples

>>> to_sql(10)

‘10’

>>> to_sql(10.5)

‘10.5’

>>> to_sql("test_muid")

“‘test_muid’”

>>> to_sql(True)

‘1’

>>> to_sql(None)

‘NULL’