Lookups API

django_spanner.lookups.cast_param_to_float(self, compiler, connection)[source]

A method to extend Django Exact, GreaterThan, GreaterThanOrEqual, LessThan, and LessThanOrEqual classes.

Parameters
  • self (Exact or GreaterThan or GreaterThanOrEqual or LessThan or LessThanOrEqual) – the instance of the class that owns this method.

  • compiler (SQLCompilerst) – The query compiler responsible for generating the query. Must have a compile method, returning a (sql, [params]) tuple. Calling compiler(value) will return a quoted value.

  • connection (Connection) – The Spanner database connection used for the current query.

Return type

tuple[str, str]

Returns

A tuple of the SQL request and float parameters.

django_spanner.lookups.contains(self, compiler, connection)[source]

A method to extend Django Contains and IContains classes.

Parameters
  • self (Contains or IContains) – the instance of the class that owns this method.

  • compiler (SQLCompilerst) – The query compiler responsible for generating the query. Must have a compile method, returning a (sql, [params]) tuple. Calling compiler(value) will return a quoted value.

  • connection (Connection) – The Spanner database connection used for the current query.

Return type

tuple[str, str]

Returns

A tuple of the SQL request and parameters.

django_spanner.lookups.iexact(self, compiler, connection)[source]

A method to extend Django IExact class. Case-insensitive exact match. If the value provided for comparison is None, it will be interpreted as an SQL NULL.

Parameters
  • self (IExact) – the instance of the class that owns this method.

  • compiler (SQLCompilerst) – The query compiler responsible for generating the query. Must have a compile method, returning a (sql, [params]) tuple. Calling compiler(value) will return a quoted value.

  • connection (Connection) – The Spanner database connection used for the current query.

Return type

tuple[str, str]

Returns

A tuple of the SQL request and parameters.

django_spanner.lookups.regex(self, compiler, connection)[source]

A method to extend Django Regex and IRegex classes.

Parameters
  • self (Regex or IRegex) – the instance of the class that owns this method.

  • compiler (SQLCompilerst) – The query compiler responsible for generating the query. Must have a compile method, returning a (sql, [params]) tuple. Calling compiler(value) will return a quoted value.

  • connection (Connection) – The Spanner database connection used for the current query.

Return type

tuple[str, str]

Returns

A tuple of the SQL request and parameters.

django_spanner.lookups.register_lookups()[source]

Registers the above methods with the corersponding Django classes.

django_spanner.lookups.startswith_endswith(self, compiler, connection)[source]

A method to extend Django StartsWith, IStartsWith, EndsWith, and IEndsWith classes.

Parameters
  • self (StartsWith or IStartsWith or EndsWith or IEndsWith) – the instance of the class that owns this method.

  • compiler (SQLCompilerst) – The query compiler responsible for generating the query. Must have a compile method, returning a (sql, [params]) tuple. Calling compiler(value) will return a quoted value.

  • connection (Connection) – The Spanner database connection used for the current query.

Return type

tuple[str, str]

Returns

A tuple of the SQL request and parameters.