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.

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