Basic Usage
API Reference
Connecting
import mariadb
# Establish a connection using URI
with mariadb.connect("mariadb://example_user:GHbe_Su3B8@localhost/test") as conn:
with conn.cursor() as cursor:
# Populate countries table with some data
cursor.execute("INSERT INTO countries(name, country_code, capital) VALUES (?,?,?)",
("Germany", "GER", "Berlin"))
# retrieve data
cursor.execute("SELECT name, country_code, capital FROM countries")
# print content
row = cursor.fetchone()
print(*row, sep=' ')Passing parameters to SQL statements
Using indicators
NOTE
Supported Data types
Supported Data Types
Python type
SQL type
Last updated
Was this helpful?

