SqliteQueryBuilder¶
-
class
privex.db.query.sqlite.
SqliteQueryBuilder
(table: str, connection: privex.db.types.GenericConnection = None, **kwargs)[source]¶ -
__init__
(table: str, connection: privex.db.types.GenericConnection = None, **kwargs) Initialize self. See help(type(self)) for accurate signature.
-
all
(query_mode=<QueryMode.ROW_DICT: 'dict'>) → Union[Iterable[dict], Iterable[tuple]][source]¶ Executes the current query, and returns an iterable cursor (results are loaded as you iterate the cursor)
Usage:
>>> results = BaseQueryBuilder('people').all() # Equivalent to ``SELECT * FROM people;`` >>> for r in results: >>> print(r['first_name'], r['last_name'], r['phone'])
- Return Iterable
A cursor which can be iterated using a
for
loop. Ideally, should load rows as you iterate, saving RAM.
-
build_query
() → str[source]¶ Used internally by
all()
andfetch()
- builds and returns a string SQL query using the various class attributes such aswhere_clauses
:return str query: The SQL query that will be sent to the database as a string
-
Methods¶
Methods
|
Executes the current query, and returns an iterable cursor (results are loaded as you iterate the cursor) |
Used internally by |
|
|
Executes the current query, and fetches the first result as a |
|
Similar to |