This repository was archived by the owner on Oct 29, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
General Usage
Miku edited this page May 29, 2022
·
2 revisions
The libray offers the possibility to continuously extend the SQL script by returning itself.
With the execution this possibility is terminated. Example ends get_sql(), execute(), fetchone() or fetchall(). Endpoints are defined in the builders in the section endpoints. Repetable are defined in the section Repeatable.
conn.table("myTable").select("name, age, email").where("age", 20).where("name", "Benjamin").where("email", "benjamin@mail.com").fetchone()Fetch One returns a list with the data. The structure results from the pure sequence of the columns
["Benjamin", 20, "benjamin@mail.com"]Fetch All returns a list with lists with the data. The structure results from the pure sequence of the columns. Even if it contains only one result this structure is then used
[
["Benjamin", 20, "benjamin@mail.com"],
["Heike", 24, "peike@mail.com"],
["Peter", 30, "peter@mail.com"]
]This is only a example
Warning! execute and fetch will throw errors.
from mariadb_sqlbuilder.builder import TableBuilder
table = TableBuilder(None, "myTable") # no connection
# you can use it normal
sql: str = table.insert().set("id", 10).get_sql()
# example for run the sql in your own cursor
cursor.execute(sql)