Extensions to the DB API¶
Constants¶
For using constants of various types they have to be imported first:
from mariadb.constants import *
Cursor¶
MariaDB Connector/Python defines the following cursor types for server side cursors:
-
mariadb.constants.CURSOR.
NONE
¶ Don’t use a server side cursor (default)
-
mariadb.constants.CURSOR.
READ_ONLY
¶ Use a read-only server side cursor.
Indicators¶
Indicators hold supplementary information when you are modify (insert/update/delete) data with cursors executemany method. There are several distinct uses for indicator variables:
-
mariadb.constants.INDICATOR.
NULL
¶ A null value will be inserted or updated
-
mariadb.constants.INDICATOR.
DEFAULT
¶ The default value of a column will be inserted or updated
-
mariadb.constants.INDICATOR.
IGNORE
¶ Don’t update column at all
-
mariadb.constants.INDICATOR.
IGNORE_ROW
¶ Don’t update or delete row
Capability flags¶
These flags are used when establishing a connection or to check if the database is capable of a certain feature.
-
mariadb.constants.CLIENT.
MYSQL
¶ not in use/supported by MariaDB Server
-
mariadb.constants.CLIENT.
FOUND_ROWS
¶ return the number of matched rows instead of number of changed rows
-
mariadb.constants.CLIENT.
NO_SCHEMA
¶ forbids the use of database.tablename.columnname syntax and forces SQL parser to generate an error.
-
mariadb.constants.CLIENT.
LOCAL_FILES
¶ Allows LOAD DATA LOCAL INFILE statements (if not disabled on server).
-
mariadb.constants.CLIENT.
COMPRESS
¶ Use compressed protocol
-
mariadb.constants.CLIENT.
IGNORE_SPACE
¶ Allows spaces after function names. This implies, that all function names will become reserved words.
-
mariadb.constants.CLIENT.
MULTI_RESULTS
¶ Indicates that the client is able to handle multiple result sets.
Field types¶
-
mariadb.constants.FIELD_TYPE.
DECIMAL
¶ Old decimal format: Not in use anymore, instead of use NEWDECIMAL.
-
mariadb.constants.FIELD_TYPE.
TINY
¶ Represents SQL type TINYINT
-
mariadb.constants.FIELD_TYPE.
SHORT
¶ Represents SQL type SMALLINT
-
mariadb.constants.FIELD_TYPE.
LONG
¶ Represents SQL type INT
-
mariadb.constants.FIELD_TYPE.
FLOAT
¶ Represents SQL type FLOAT
-
mariadb.constants.FIELD_TYPE.
DOUBLE
¶ Represents SQL type DOUBLE
-
mariadb.constants.FIELD_TYPE.
NULL
¶ Represents SQL type NULL
-
mariadb.constants.FIELD_TYPE.
TIMESTAMP
¶ Represents SQL type TIMESTAMP
-
mariadb.constants.FIELD_TYPE.
LONGLONG
¶ Represents SQL type BIGINT
-
mariadb.constants.FIELD_TYPE.
INT24
¶ Represents SQL type MEDIUMINT
-
mariadb.constants.FIELD_TYPE.
DATETIME
¶ Represents SQL type DATETIME
-
mariadb.constants.FIELD_TYPE.
YEAR
¶ Represents SQL type YEAR
-
mariadb.constants.FIELD_TYPE.
NEWDATE
¶ Represents SQL type DATE
-
mariadb.constants.FIELD_TYPE.
VARCHAR
¶ Represents SQL type VARCHAR
-
mariadb.constants.FIELD_TYPE.
BIT
¶ Represents SQL type BIT
-
mariadb.constants.FIELD_TYPE.
JSON
¶ Represents SQL type JSON
-
mariadb.constants.FIELD_TYPE.
NEWDECIMAL
¶ Represents SQL type DECIMAL
-
mariadb.constants.FIELD_TYPE.
ENUM
¶ Represents SQL type ENUM
-
mariadb.constants.FIELD_TYPE.
SET
¶ Represents SQL type SET
-
mariadb.constants.FIELD_TYPE.
TINY_BLOB
¶ Represents SQL type TINYBLOB or TINYTEXT
-
mariadb.constants.FIELD_TYPE.
MEDIUM_BLOB
¶ Represents SQL type MEDIUMBLOB or MEDIUMTEXT
-
mariadb.constants.FIELD_TYPE.
LONG_BLOB
¶ Represents SQL type LONGBLOB or LONGTEXT
-
mariadb.constants.FIELD_TYPE.
BLOB
¶ Represents SQL type BLOB or TEXT
-
mariadb.constants.FIELD_TYPE.
GEOMETRY
¶ Represents SQL type GEOMETRY