Class: QgsProviderSqlQueryBuilder

Provides an interface for provider-specific creation of SQL queries.

The QgsProviderSqlQueryBuilder provides an interface for creation of SQL queries, which can be overridden for backend provider specific SQL syntax.

Added in version 3.28.

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsProviderSqlQueryBuilder. See the FAQ for more details.

createLimitQueryForTable

Returns a result size limited SQL query string generated for the given schema and table name, retrieving all columns for the first limit rows.

quoteIdentifier

Returns a properly quoted version of a table/schema identifier.

class qgis.core.QgsProviderSqlQueryBuilder[source]

Bases: object

virtual createLimitQueryForTable(self, schema: str | None, name: str | None, limit: int = 10) str[source]

Returns a result size limited SQL query string generated for the given schema and table name, retrieving all columns for the first limit rows.

The base class method returns the SQL query “SELECT * FROM table LIMIT 10”. Subclasses may return database specific equivalents to this query.

Parameters:
  • schema (Optional[str])

  • name (Optional[str])

  • limit (int = 10)

Return type:

str

virtual quoteIdentifier(self, identifier: str | None) str[source]

Returns a properly quoted version of a table/schema identifier.

Parameters:

identifier (Optional[str])

Return type:

str