Terarea  2
The automation project
Loading...
Searching...
No Matches
sql_constants.py
Go to the documentation of this file.
1"""
2 File in charge of storing information that is required for the sql library, but is constant.
3"""
4
5from typing import List
6
7# initialisation arguments to remove if empty (or equal to None)
8UNWANTED_ARGUMENTS = [
9 "option_files"
10
11]
12
13# Sql sanitisation for word that can be considered as commands
14RISKY_KEYWORDS: List[str] = [
15 "add", "all", "alter", "analyze", "and", "as", "asc", "asensitive", "before", "between",
16 "bigint", "binary", "blob", "both", "by", "call", "cascade", "case", "change", "char",
17 "character", "check", "collate", "column", "condition", "constraint", "continue",
18 "convert", "create", "cross", "current_date", "current_time", "current_timestamp",
19 "cursor", "database", "databases", "day_hour", "day_microsecond", "day_minute",
20 "day_second", "dec", "decimal", "declare", "default", "delayed", "delete", "desc",
21 "describe", "deterministic", "distinct", "distinctrow", "div", "double", "drop",
22 "dual", "each", "else", "elseif", "enclosed", "escaped", "exists", "exit", "explain",
23 "false", "fetch", "float", "for", "force", "foreign", "from", "fulltext", "general",
24 "grant", "group", "having", "high_priority", "hour_microsecond", "hour_minute",
25 "hour_second", "if", "ignore", "in", "index", "infile", "inner", "inout",
26 "insensitive", "insert", "int", "integer", "interval", "into", "is", "iterate", "join",
27 "key", "keys", "kill", "leading", "leave", "left", "like", "limit", "linear", "lines",
28 "load", "localtime", "localtimestamp", "lock", "long", "longblob", "longtext", "loop",
29 "low_priority", "master_ssl_verify_server_cert", "match", "maxvalue", "mediumblob",
30 "mediumint", "mediumtext", "middleint", "minute_microsecond", "minute_second", "mod",
31 "modifies", "natural", "not", "no_write_to_binlog", "null", "numeric", "on", "optimize",
32 "option", "optionally", "or", "order", "out", "outer", "outfile", "precision", "primary",
33 "procedure", "purge", "range", "read", "reads", "read_write", "real", "references",
34 "regexp", "release", "rename", "repeat", "replace", "require", "resignal", "restrict",
35 "return", "revoke", "right", "rlike", "schema", "schemas", "second_microsecond",
36 "select", "sensitive", "separator", "set", "show", "signal", "smallint", "spatial",
37 "specific", "sql", "sqlexception", "sqlstate", "sqlwarning", "sql_big_result",
38 "sql_calc_found_rows", "sql_small_result", "ssl", "starting", "stored", "straight_join",
39 "table", "terminated", "then", "tinyblob", "tinyint", "tinytext", "to", "trailing",
40 "trigger", "true", "undo", "union", "unique", "unlock", "unsigned", "update", "usage",
41 "use", "using", "utc_date", "utc_time", "utc_timestamp", "values", "varbinary",
42 "varchar", "varcharacter", "varying", "virtual", "when", "where", "while", "with",
43 "write", "xor", "year_month", "zerofill"
44]
45
46KEYWORD_LOGIC_GATES: List[str] = [
47 'and', 'or', 'not', 'xor', 'between', 'in', 'is', 'like', 'regexp', 'rlike', 'null', 'true', 'false', 'exists',
48 'distinct', 'limit', 'having', 'join', 'union', 'current_date', 'current_time', 'current_timestamp', 'utc_date',
49 'utc_time', 'utc_timestamp', 'mod', 'if'
50]
51
52
53DATE_ONLY: str = '%Y-%m-%d'
54
55DATE_AND_TIME: str = '%Y-%m-%d %H:%M:%S'
56
57# Error messages
58CONNECTION_FAILED: str = "Connection to the database is non-existant, aborting command."
59
60CURSOR_FAILED: str = "Cursor to the database is non-existant, aborting command."
61
62# Specific error codes
63GET_TABLE_SIZE_ERROR: int = (-1)