PSQL序

切换到postgres用户进入数据库控制台

hightlight:true
1
sudo -u postgres psql

创建新数据库

hightlight:true
1
create database newdbname [owner username]

赋予用户数据库所有权限

hightlight:true
1
grant all privileges on database dbname to username

更改数据库owner

hightlight:true
1
alter database dbname owner to username

查看所有数据库列表

hightlight:true
1
\l

连接数据库

hightlight:true
1
\c dbname 

显示所有的schema

hightlight:true
1
\dn

显示所有的用户

hightlight:true
1
\du

显示表的权限分配情况

hightlight:true
1
\dp

显示当前的模式

hightlight:true
1
show search_path

更改模式

hightlight:true
1
set search_path to myschema

已列的形式展示或取消

hightlight:true
1
\x 

查看所有表

hightlight:true
1
\dt

显示执行时间

hightlight:true
1
\timing on     

关闭显示执行时间

hightlight:true
1
\timing off

禁用全表扫描

hightlight:true
1
2
alter role rolename set enable_seqscan = off;
set enable_seqscan = off;

PSQL COMMANDS

General

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
\copyright             
# show PostgreSQL usage and distribution terms

\errverbose
# show most recent error message at maximum verbosity

\g [FILE] or ;
# execute query (and send results to file or |pipe)

\gexec
# execute query, then execute each value in its result

\gset [PREFIX]
# execute query and store results in psql variables

\q
# quit psql

\crosstabview [COLUMNS]
# execute query and display results in crosstab

\watch [SEC]
# execute query every SEC seconds

Help

1
2
3
4
5
6
7
8
9
10
11
\? [commands]          
# show help on backslash commands

\? options
# show help on psql command-line options

\? variables
# show help on special variables

\h [NAME]
# help on syntax of SQL commands, * for all commands

Query Buffer

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
\e [FILE] [LINE]       
# edit the query buffer (or file) with external editor

\ef [FUNCNAME [LINE]]
# edit function definition with external editor

\ev [VIEWNAME [LINE]]
# edit view definition with external editor

\p
# show the contents of the query buffer

\r
# reset (clear) the query buffer

\s [FILE]
# display history or save it to file

\w FILE
# write query buffer to file

Input/Output

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
\copy ...              
# perform SQL COPY with data stream to the client host

\echo [STRING]
# write string to standard output

\i FILE
# execute commands from file

\ir FILE
# as \i, but relative to location of current script

\o [FILE]
# send all query results to file or |pipe

\qecho [STRING]
# write string to query output stream (see \o)

Informational

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
(options: S = show system objects, + = additional detail)

\d[S+]
# list tables, views, and sequences

\d[S+] NAME
# describe table, view, sequence, or index

\da[S] [PATTERN]
# list aggregates

\dA[+] [PATTERN]
# list access methods

\db[+] [PATTERN]
# list tablespaces

\dc[S+] [PATTERN]
# list conversions

\dC[+] [PATTERN]
# list casts

\dd[S] [PATTERN]
# show object descriptions not displayed elsewhere

\ddp [PATTERN]
# list default privileges

\dD[S+] [PATTERN]
# list domains

\det[+] [PATTERN]
# list foreign tables

\des[+] [PATTERN]
# list foreign servers

\deu[+] [PATTERN]
# list user mappings

\dew[+] [PATTERN]
# list foreign-data wrappers

\df[antw][S+] [PATRN]
# list [only agg/normal/trigger/window] functions

\dF[+] [PATTERN]
# list text search configurations

\dFd[+] [PATTERN]
# list text search dictionaries

\dFp[+] [PATTERN]
# list text search parsers

\dFt[+] [PATTERN]
# list text search templates

\dg[S+] [PATTERN]
# list roles

\di[S+] [PATTERN]
# list indexes

\dl
# list large objects, same as \lo_list

\dL[S+] [PATTERN]
# list procedural languages

\dm[S+] [PATTERN]
# list materialized views

\dn[S+] [PATTERN]
# list schemas

\do[S] [PATTERN]
# list operators

\dO[S+] [PATTERN]
# list collations

\dp [PATTERN]
# list table, view, and sequence access privileges

\drds [PATRN1 [PATRN2]]
# list per-database role settings

\ds[S+] [PATTERN]
# list sequences

\dt[S+] [PATTERN]
# list tables

\dT[S+] [PATTERN]
# list data types

\du[S+] [PATTERN]
# list roles

\dv[S+] [PATTERN]
# list views

\dE[S+] [PATTERN]
# list foreign tables

\dx[+] [PATTERN]
# list extensions

\dy [PATTERN]
# list event triggers

\l[+] [PATTERN]
# list databases

\sf[+] FUNCNAME
# show a function's definition

\sv[+] VIEWNAME
# show a view's definition

\z [PATTERN]
# same as \dp

Formatting

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
\a                     
# toggle between unaligned and aligned output mode

\C [STRING]
# set table title, or unset if none

\f [STRING]
# show or set field separator for unaligned query output

\H
# toggle HTML output mode (currently off)

\pset [NAME [VALUE]]
# set table output option
# (NAME := {border|columns|expanded|fieldsep|fieldsep_zero|
# footer|format|linestyle|null|numericlocale|pager|
# pager_min_lines|recordsep|recordsep_zero|tableattr|title|
# tuples_only|unicode_border_linestyle|
# unicode_column_linestyle|unicode_header_linestyle})

\t [on|off]
# show only rows (currently off)

\T [STRING]
# set HTML <table> tag attributes, or unset if none

\x [on|off|auto]
# toggle expanded output (currently off)

Connection

1
2
3
4
5
6
7
8
9
10
11
\c[onnect] {[DBNAME|- USER|- HOST|- PORT|-] | conninfo}
# connect to new database (currently "crm_online_test")

\encoding [ENCODING]
# show or set client encoding

\password [USERNAME]
# securely change the password for a user

\conninfo
# display information about current connection

Operating System

1
2
3
4
5
6
7
8
9
10
11
\cd [DIR]              
# change the current working directory

\setenv NAME [VALUE]
# set or unset environment variable

\timing [on|off]
# toggle timing of commands (currently on)

\! [COMMAND]
# execute command in shell or start interactive shell

Variables

1
2
3
4
5
6
7
8
\prompt [TEXT] NAME    
# prompt user to set internal variable

\set [NAME [VALUE]]
# set internal variable, or list all if no parameters

\unset NAME
# unset (delete) internal variable

Large Objects

1
2
3
4
5
6
7
8
\lo_export LOBOID FILE

\lo_import FILE [COMMENT]

\lo_list

\lo_unlink LOBOID
# large object operations

SQL Commands

全览图

命令表

ABORT COMMENT DECLARE EXECUTE
ALTER AGGREGATE COMMIT DELETE EXPLAIN
ALTER COLLATION COMMIT PREPARED DISCARD FETCH
ALTER CONVERSION COPY DO GRANT
ALTER DATABASE CREATE ACCESS METHOD DROP ACCESS METHOD IMPORT FOREIGN SCHEMA
ALTER DEFAULT PRIVILEGES CREATE AGGREGATE DROP AGGREGATE INSERT
ALTER DOMAIN CREATE CAST DROP CAST LISTEN
ALTER EVENT TRIGGER CREATE COLLATION DROP COLLATION LOAD
ALTER EXTENSION CREATE CONVERSION DROP CONVERSION LOCK
ALTER FOREIGN DATA WRAPPER CREATE DATABASE DROP DATABASE MOVE
ALTER FOREIGN TABLE CREATE DOMAIN DROP DOMAIN NOTIFY
ALTER FUNCTION CREATE EVENT TRIGGER DROP EVENT TRIGGER PREPARE
ALTER GROUP CREATE EXTENSION DROP EXTENSION PREPARE TRANSACTION
ALTER INDEX CREATE FOREIGN DATA WRAPPER DROP FOREIGN DATA WRAPPER REASSIGN OWNED
ALTER LANGUAGE CREATE FOREIGN TABLE DROP FOREIGN TABLE REFRESH MATERIALIZED VIEW
ALTER LARGE OBJECT CREATE FUNCTION DROP FUNCTION REINDEX
ALTER MATERIALIZED VIEW CREATE GROUP DROP GROUP RELEASE SAVEPOINT
ALTER OPERATOR CREATE INDEX DROP INDEX RESET
ALTER OPERATOR CLASS CREATE LANGUAGE DROP LANGUAGE REVOKE
ALTER OPERATOR FAMILY CREATE MATERIALIZED VIEW DROP MATERIALIZED VIEW ROLLBACK
ALTER POLICY CREATE OPERATOR DROP OPERATOR ROLLBACK PREPARED
ALTER ROLE CREATE OPERATOR CLASS DROP OPERATOR CLASS ROLLBACK TO SAVEPOINT
ALTER RULE CREATE OPERATOR FAMILY DROP OPERATOR FAMILY SAVEPOINT
ALTER SCHEMA CREATE POLICY DROP OWNED SECURITY LABEL
ALTER SEQUENCE CREATE ROLE DROP POLICY SELECT
ALTER SERVER CREATE RULE DROP ROLE SELECT INTO
ALTER SYSTEM CREATE SCHEMA DROP RULE SET
ALTER TABLE CREATE SEQUENCE DROP SCHEMA SET CONSTRAINTS
ALTER TABLESPACE CREATE SERVER DROP SEQUENCE SET ROLE
ALTER TEXT SEARCH CONFIGURATION CREATE TABLE DROP SERVER SET SESSION AUTHORIZATION
ALTER TEXT SEARCH DICTIONARY CREATE TABLE AS DROP TABLE SET TRANSACTION
ALTER TEXT SEARCH PARSER CREATE TABLESPACE DROP TABLESPACE SHOW
ALTER TEXT SEARCH TEMPLATE CREATE TEXT SEARCH CONFIGURATION DROP TEXT SEARCH CONFIGURATION START TRANSACTION
ALTER TRIGGER CREATE TEXT SEARCH DICTIONARY DROP TEXT SEARCH DICTIONARY TABLE
ALTER TYPE CREATE TEXT SEARCH PARSER DROP TEXT SEARCH PARSER TRUNCATE
ALTER USER CREATE TEXT SEARCH TEMPLATE DROP TEXT SEARCH TEMPLATE UNLISTEN
ALTER USER MAPPING CREATE TRANSFORM DROP TRANSFORM UPDATE
ALTER VIEW CREATE TRIGGER DROP TRIGGER VACUUM
ANALYZE CREATE TYPE DROP TYPE VALUES
BEGIN CREATE USER DROP USER WITH
CHECKPOINT CREATE USER MAPPING DROP USER MAPPING
CLOSE CREATE VIEW DROP VIEW
CLUSTER DEALLOCATE END

MySQL Connector/Python

Help on package mysql.connector in mysql

NAME
1
# mysql.connector - MySQL Connector/Python - MySQL driver written in Python
PACKAGE CONTENTS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
abstracts
authentication
catch23
charsets
connection
connection_cext
constants
conversion
cursor
cursor_cext
custom_types
dbapi
django (package)
errorcode
errors
locales (package)
network
optionfiles
pooling
protocol
utils
version
CLASSES
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
builtins.Exception(builtins.BaseException)
- mysql.connector.errors.Error
- mysql.connector.errors.DatabaseError
- mysql.connector.errors.DataError
- mysql.connector.errors.IntegrityError
- mysql.connector.errors.InternalError
- mysql.connector.errors.NotSupportedError
- mysql.connector.errors.OperationalError
- mysql.connector.errors.ProgrammingError
- mysql.connector.errors.InterfaceError
- mysql.connector.errors.Warning

builtins.object
- builtins.bytes
- datetime.date
- datetime.datetime
- datetime.time

mysql.connector.abstracts.MySQLConnectionAbstract(mysql.connector.abstracts.MySQLConnectionAbstract, builtins.object)
- mysql.connector.connection.MySQLConnection
- mysql.connector.connection_cext.CMySQLConnection

mysql.connector.constants._Constants(builtins.object)
- mysql.connector.constants.CharacterSet
- mysql.connector.constants.FieldType
- mysql.connector.constants.RefreshOption

mysql.connector.constants._Flags(mysql.connector.constants._Constants)
- mysql.connector.constants.ClientFlag
- mysql.connector.constants.FieldFlag
Binary
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
Binary = class bytes(object)
| bytes(iterable_of_ints) -> bytes
| bytes(string, encoding[, errors]) -> bytes
| bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
| bytes(int) -> bytes object of size given by the parameter initialized with null bytes
| bytes() -> empty bytes object
|
| Construct an immutable array of bytes from:
| - an iterable yielding integers in range(256)
| - a text string encoded using the specified encoding
| - any object implementing the buffer API.
| - an integer
|
| Methods defined here:
|
| __add__(self, value, /)
| Return self+value.
|
| __contains__(self, key, /)
| Return key in self.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __getitem__(self, key, /)
| Return self[key].
|
| __getnewargs__(...)
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __iter__(self, /)
| Implement iter(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __len__(self, /)
| Return len(self).
|
| __lt__(self, value, /)
| Return self<value.
|
| __mod__(self, value, /)
| Return self%value.
|
| __mul__(self, value, /)
| Return self*value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __repr__(self, /)
| Return repr(self).
|
| __rmod__(self, value, /)
| Return value%self.
|
| __rmul__(self, value, /)
| Return value*self.
|
| __str__(self, /)
| Return str(self).
|
| capitalize(...)
| B.capitalize() -> copy of B
|
| Return a copy of B with only its first character capitalized (ASCII)
| and the rest lower-cased.
|
| center(...)
| B.center(width[, fillchar]) -> copy of B
|
| Return B centered in a string of length width. Padding is
| done using the specified fill character (default is a space).
|
| count(...)
| B.count(sub[, start[, end]]) -> int
|
| Return the number of non-overlapping occurrences of subsection sub in
| bytes B[start:end]. Optional arguments start and end are interpreted
| as in slice notation.
|
| decode(self, /, encoding='utf-8', errors='strict')
| Decode the bytes using the codec registered for encoding.
|
| encoding
| The encoding with which to decode the bytes.
| errors
| The error handling scheme to use for the handling of decoding errors.
| The default is 'strict' meaning that decoding errors raise a
| UnicodeDecodeError. Other possible values are 'ignore' and 'replace'
| as well as any other name registered with codecs.register_error that
| can handle UnicodeDecodeErrors.
|
| endswith(...)
| B.endswith(suffix[, start[, end]]) -> bool
|
| Return True if B ends with the specified suffix, False otherwise.
| With optional start, test B beginning at that position.
| With optional end, stop comparing B at that position.
| suffix can also be a tuple of bytes to try.
|
| expandtabs(...)
| B.expandtabs(tabsize=8) -> copy of B
|
| Return a copy of B where all tab characters are expanded using spaces.
| If tabsize is not given, a tab size of 8 characters is assumed.
|
| find(...)
| B.find(sub[, start[, end]]) -> int
|
| Return the lowest index in B where subsection sub is found,
| such that sub is contained within B[start,end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| hex(...)
| B.hex() -> string
|
| Create a string of hexadecimal numbers from a bytes object.
| Example: b'\xb9\x01\xef'.hex() -> 'b901ef'.
|
| index(...)
| B.index(sub[, start[, end]]) -> int
|
| Return the lowest index in B where subsection sub is found,
| such that sub is contained within B[start,end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raises ValueError when the subsection is not found.
|
| isalnum(...)
| B.isalnum() -> bool
|
| Return True if all characters in B are alphanumeric
| and there is at least one character in B, False otherwise.
|
| isalpha(...)
| B.isalpha() -> bool
|
| Return True if all characters in B are alphabetic
| and there is at least one character in B, False otherwise.
|
| isascii(...)
| B.isascii() -> bool
|
| Return True if B is empty or all characters in B are ASCII,
| False otherwise.
|
| isdigit(...)
| B.isdigit() -> bool
|
| Return True if all characters in B are digits
| and there is at least one character in B, False otherwise.
|
| islower(...)
| B.islower() -> bool
|
| Return True if all cased characters in B are lowercase and there is
| at least one cased character in B, False otherwise.
|
| isspace(...)
| B.isspace() -> bool
|
| Return True if all characters in B are whitespace
| and there is at least one character in B, False otherwise.
|
| istitle(...)
| B.istitle() -> bool
|
| Return True if B is a titlecased string and there is at least one
| character in B, i.e. uppercase characters may only follow uncased
| characters and lowercase characters only cased ones. Return False
| otherwise.
|
| isupper(...)
| B.isupper() -> bool
|
| Return True if all cased characters in B are uppercase and there is
| at least one cased character in B, False otherwise.
|
| join(self, iterable_of_bytes, /)
| Concatenate any number of bytes objects.
|
| The bytes whose method is called is inserted in between each pair.
|
| The result is returned as a new bytes object.
|
| Example: b'.'.join([b'ab', b'pq', b'rs']) -> b'ab.pq.rs'.
|
| ljust(...)
| B.ljust(width[, fillchar]) -> copy of B
|
| Return B left justified in a string of length width. Padding is
| done using the specified fill character (default is a space).
|
| lower(...)
| B.lower() -> copy of B
|
| Return a copy of B with all ASCII characters converted to lowercase.
|
| lstrip(self, bytes=None, /)
| Strip leading bytes contained in the argument.
|
| If the argument is omitted or None, strip leading ASCII whitespace.
|
| partition(self, sep, /)
| Partition the bytes into three parts using the given separator.
|
| This will search for the separator sep in the bytes. If the separator is found,
| returns a 3-tuple containing the part before the separator, the separator
| itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing the original bytes
| object and two empty bytes objects.
|
| replace(self, old, new, count=-1, /)
| Return a copy with all occurrences of substring old replaced by new.
|
| count
| Maximum number of occurrences to replace.
| -1 (the default value) means replace all occurrences.
|
| If the optional argument count is given, only the first count occurrences are
| replaced.
|
| rfind(...)
| B.rfind(sub[, start[, end]]) -> int
|
| Return the highest index in B where subsection sub is found,
| such that sub is contained within B[start,end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Return -1 on failure.
|
| rindex(...)
| B.rindex(sub[, start[, end]]) -> int
|
| Return the highest index in B where subsection sub is found,
| such that sub is contained within B[start,end]. Optional
| arguments start and end are interpreted as in slice notation.
|
| Raise ValueError when the subsection is not found.
|
| rjust(...)
| B.rjust(width[, fillchar]) -> copy of B
|
| Return B right justified in a string of length width. Padding is
| done using the specified fill character (default is a space)
|
| rpartition(self, sep, /)
| Partition the bytes into three parts using the given separator.
|
| This will search for the separator sep in the bytes, starting at the end. If
| the separator is found, returns a 3-tuple containing the part before the
| separator, the separator itself, and the part after it.
|
| If the separator is not found, returns a 3-tuple containing two empty bytes
| objects and the original bytes object.
|
| rsplit(self, /, sep=None, maxsplit=-1)
| Return a list of the sections in the bytes, using sep as the delimiter.
|
| sep
| The delimiter according which to split the bytes.
| None (the default value) means split on ASCII whitespace characters
| (space, tab, return, newline, formfeed, vertical tab).
| maxsplit
| Maximum number of splits to do.
| -1 (the default value) means no limit.
|
| Splitting is done starting at the end of the bytes and working to the front.
|
| rstrip(self, bytes=None, /)
| Strip trailing bytes contained in the argument.
|
| If the argument is omitted or None, strip trailing ASCII whitespace.
|
| split(self, /, sep=None, maxsplit=-1)
| Return a list of the sections in the bytes, using sep as the delimiter.
|
| sep
| The delimiter according which to split the bytes.
| None (the default value) means split on ASCII whitespace characters
| (space, tab, return, newline, formfeed, vertical tab).
| maxsplit
| Maximum number of splits to do.
| -1 (the default value) means no limit.
|
| splitlines(self, /, keepends=False)
| Return a list of the lines in the bytes, breaking at line boundaries.
|
| Line breaks are not included in the resulting list unless keepends is given and
| true.
|
| startswith(...)
| B.startswith(prefix[, start[, end]]) -> bool
|
| Return True if B starts with the specified prefix, False otherwise.
| With optional start, test B beginning at that position.
| With optional end, stop comparing B at that position.
| prefix can also be a tuple of bytes to try.
|
| strip(self, bytes=None, /)
| Strip leading and trailing bytes contained in the argument.
|
| If the argument is omitted or None, strip leading and trailing ASCII whitespace.
|
| swapcase(...)
| B.swapcase() -> copy of B
|
| Return a copy of B with uppercase ASCII characters converted
| to lowercase ASCII and vice versa.
|
| title(...)
| B.title() -> copy of B
|
| Return a titlecased version of B, i.e. ASCII words start with uppercase
| characters, all remaining cased characters have lowercase.
|
| translate(self, table, /, delete=b'')
| Return a copy with each character mapped by the given translation table.
|
| table
| Translation table, which must be a bytes object of length 256.
|
| All characters occurring in the optional argument delete are removed.
| The remaining characters are mapped through the given translation table.
|
| upper(...)
| B.upper() -> copy of B
|
| Return a copy of B with all ASCII characters converted to uppercase.
|
| zfill(...)
| B.zfill(width) -> copy of B
|
| Pad a numeric string B with zeros on the left, to fill a field
| of the specified width. B is never truncated.
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromhex(string, /) from builtins.type
| Create a bytes object from a string of hexadecimal numbers.
|
| Spaces between two numbers are accepted.
| Example: bytes.fromhex('B9 01EF') -> b'\\xb9\\x01\\xef'.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| maketrans(frm, to, /)
| Return a translation table useable for the bytes or bytearray translate method.
|
| The returned table will be one where each byte in frm is mapped to the byte at
| the same position in to.
|
| The bytes objects frm and to must be of the same length.

class CMySQLConnection(mysql.connector.abstracts.MySQLConnectionAbstract)
| CMySQLConnection(**kwargs)
|
| Class initiating a MySQL Connection using Connector/C
|
| Method resolution order:
| CMySQLConnection
| mysql.connector.abstracts.MySQLConnectionAbstract
| mysql.connector.abstracts.MySQLConnectionAbstract
| builtins.object
|
| Methods defined here:
|
| __init__(self, **kwargs)
| Initialization
|
| close(self)
| Disconnect from the MySQL server
|
| cmd_change_user(self, username='', password='', database='', charset=45)
| Change the current logged in user
|
| cmd_init_db(self, database)
| Change the current database
|
| cmd_process_kill(self, mysql_pid)
| Kill a MySQL process
|
| cmd_query(self, query, raw=None, buffered=False, raw_as_string=False)
| Send a query to the MySQL server
|
| cmd_quit(self)
| Close the current connection with the server
|
| cmd_refresh(self, options)
| Send the Refresh command to the MySQL server
|
| cmd_shutdown(self, shutdown_type=None)
| Shut down the MySQL Server
|
| cmd_statistics(self)
| Return statistics from the MySQL server
|
| commit(self)
| Commit current transaction
|
| consume_results(self)
| Consume the current result
|
| This method consume the result by reading (consuming) all rows.
|
| cursor(self, buffered=None, raw=None, prepared=None, cursor_class=None, dictionary=None, named_tuple=None)
| Instantiates and returns a cursor using C Extension
|
| By default, CMySQLCursor is returned. Depending on the options
| while connecting, a buffered and/or raw cursor is instantiated
| instead. Also depending upon the cursor options, rows can be
| returned as dictionary or named tuple.
|
| Dictionary and namedtuple based cursors are available with buffered
| output but not raw.
|
| It is possible to also give a custom cursor through the
| cursor_class parameter, but it needs to be a subclass of
| mysql.connector.cursor_cext.CMySQLCursor.
|
| Raises ProgrammingError when cursor_class is not a subclass of
| CursorBase. Raises ValueError when cursor is not available.
|
| Returns instance of CMySQLCursor or subclass.
|
| :param buffered: Return a buffering cursor
| :param raw: Return a raw cursor
| :param prepared: Return a cursor which uses prepared statements
| :param cursor_class: Use a custom cursor class
| :param dictionary: Rows are returned as dictionary
| :param named_tuple: Rows are returned as named tuple
| :return: Subclass of CMySQLCursor
| :rtype: CMySQLCursor or subclass
|
| disconnect = close(self)
|
| fetch_eof_columns(self)
| Fetch EOF and column information
|
| fetch_eof_status(self)
| Fetch EOF and status information
|
| free_result(self)
| Frees the result
|
| get_row(self, binary=False, columns=None, raw=None)
| Get the next rows returned by the MySQL server
|
| get_rows(self, count=None, binary=False, columns=None, raw=None)
| Get all or a subset of rows returned by the MySQL server
|
| handle_unread_result(self)
| Check whether there is an unread result
|
| info_query(self, query)
| Send a query which only returns 1 row
|
| is_connected(self)
| Reports whether the connection to MySQL Server is available
|
| next_result(self)
| Reads the next result
|
| ping(self, reconnect=False, attempts=1, delay=0)
| Check availability of the MySQL server
|
| When reconnect is set to True, one or more attempts are made to try
| to reconnect to the MySQL server using the reconnect()-method.
|
| delay is the number of seconds to wait between each retry.
|
| When the connection is not available, an InterfaceError is raised. Use
| the is_connected()-method if you just want to check the connection
| without raising an error.
|
| Raises InterfaceError on errors.
|
| prepare_for_mysql(self, params)
| Prepare parameters for statements
|
| This method is use by cursors to prepared parameters found in the
| list (or tuple) params.
|
| Returns dict.
|
| rollback(self)
| Rollback current transaction
|
| set_character_set_name(self, charset)
| Sets the default character set name for current connection.
|
| set_unicode(self, value=True)
| Toggle unicode mode
|
| Set whether we return string fields as unicode or not.
| Default is True.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| autocommit
| Get whether autocommit is on or off
|
| connection_id
| MySQL connection ID
|
| database
| Get the current database
|
| in_transaction
| MySQL session has started a transaction
|
| more_results
| Check if there are more results
|
| num_rows
| Returns number of rows of current result set
|
| result_set_available
| Check if a result set is available
|
| unread_result
| Check if there are unread results or rows
|
| warning_count
| Returns number of warnings
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from mysql.connector.abstracts.MySQLConnectionAbstract:
|
| cmd_debug(self)
| Send the DEBUG command
|
| cmd_ping(self)
| Send the PING command
|
| cmd_process_info(self)
| Get the process list of the MySQL Server
|
| This method is a placeholder to notify that the PROCESS_INFO command
| is not supported by raising the NotSupportedError. The command
| "SHOW PROCESSLIST" should be send using the cmd_query()-method or
| using the INFORMATION_SCHEMA database.
|
| Raises NotSupportedError exception
|
| cmd_query_iter(self, statements)
| Send one or more statements to the MySQL server
|
| cmd_reset_connection(self)
| Resets the session state without re-authenticating
|
| cmd_stmt_close(self, statement_id)
| Deallocate a prepared MySQL statement
|
| cmd_stmt_execute(self, statement_id, data=(), parameters=(), flags=0)
| Execute a prepared MySQL statement
|
| cmd_stmt_prepare(self, statement)
| Prepare a MySQL statement
|
| cmd_stmt_reset(self, statement_id)
| Reset data for prepared statement sent as long data
|
| cmd_stmt_send_long_data(self, statement_id, param_id, data)
| Send data for a column
|
| config(self, **kwargs)
| Configure the MySQL Connection
|
| This method allows you to configure the MySQLConnection instance.
|
| Raises on errors.
|
| connect(self, **kwargs)
| Connect to the MySQL server
|
| This method sets up the connection to the MySQL server. If no
| arguments are given, it will use the already configured or default
| values.
|
| get_server_info(self)
| Get the original MySQL version information
|
| This method returns the original MySQL server as text. If not
| previously connected, it will return None.
|
| Returns a string or None.
|
| get_server_version(self)
| Get the MySQL version
|
| This method returns the MySQL server version as a tuple. If not
| previously connected, it will return None.
|
| Returns a tuple or None.
|
| isset_client_flag(self, flag)
| Check if a client flag is set
|
| reconnect(self, attempts=1, delay=0)
| Attempt to reconnect to the MySQL server
|
| The argument attempts should be the number of times a reconnect
| is tried. The delay argument is the number of seconds to wait between
| each retry.
|
| You may want to set the number of attempts higher and use delay when
| you expect the MySQL server to be down for maintenance or when you
| expect the network to be temporary unavailable.
|
| Raises InterfaceError on errors.
|
| reset_session(self, user_variables=None, session_variables=None)
| Clears the current active session
|
| This method resets the session state, if the MySQL server is 5.7.3
| or later active session will be reset without re-authenticating.
| For other server versions session will be reset by re-authenticating.
|
| It is possible to provide a sequence of variables and their values to
| be set after clearing the session. This is possible for both user
| defined variables and session variables.
| This method takes two arguments user_variables and session_variables
| which are dictionaries.
|
| Raises OperationalError if not connected, InternalError if there are
| unread results and InterfaceError on errors.
|
| set_charset_collation(self, charset=None, collation=None)
| Sets the character set and collation for the current connection
|
| This method sets the character set and collation to be used for
| the current connection. The charset argument can be either the
| name of a character set as a string, or the numerical equivalent
| as defined in constants.CharacterSet.
|
| When the collation is not given, the default will be looked up and
| used.
|
| For example, the following will set the collation for the latin1
| character set to latin1_general_ci:
|
| set_charset('latin1','latin1_general_ci')
|
| set_client_flags(self, flags)
| Set the client flags
|
| The flags-argument can be either an int or a list (or tuple) of
| ClientFlag-values. If it is an integer, it will set client_flags
| to flags as is.
| If flags is a list (or tuple), each flag will be set or unset
| when it is negative.
|
| set_client_flags([ClientFlag.FOUND_ROWS,-ClientFlag.LONG_FLAG])
|
| Raises ProgrammingError when the flags argument is not a set or
| an integer bigger than 0.
|
| Returns self.client_flags
|
| set_converter_class(self, convclass)
| Set the converter class to be used. This should be a class overloading
| methods and members of conversion.MySQLConverter.
|
| set_login(self, username=None, password=None)
| Set login information for MySQL
|
| Set the username and/or password for the user connecting to
| the MySQL Server.
|
| start_transaction(self, consistent_snapshot=False, isolation_level=None, readonly=None)
| Start a transaction
|
| This method explicitly starts a transaction sending the
| START TRANSACTION statement to the MySQL server. You can optionally
| set whether there should be a consistent snapshot, which
| isolation level you need or which access mode i.e. READ ONLY or
| READ WRITE.
|
| For example, to start a transaction with isolation level SERIALIZABLE,
| you would do the following:
| >>> cnx = mysql.connector.connect(..)
| >>> cnx.start_transaction(isolation_level='SERIALIZABLE')
|
| Raises ProgrammingError when a transaction is already in progress
| and when ValueError when isolation_level specifies an Unknown
| level.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from mysql.connector.abstracts.MySQLConnectionAbstract:
|
| can_consume_results
| Returns whether to consume results
|
| charset
| Returns the character set for current connection
|
| This property returns the character set name of the current connection.
| The server is queried when the connection is active. If not connected,
| the configured character set name is returned.
|
| Returns a string.
|
| collation
| Returns the collation for current connection
|
| This property returns the collation name of the current connection.
| The server is queried when the connection is active. If not connected,
| the configured collation name is returned.
|
| Returns a string.
|
| get_warnings
| Get whether this connection retrieves warnings automatically
|
| This method returns whether this connection retrieves warnings
| automatically.
|
| Returns True, or False when warnings are not retrieved.
|
| python_charset
| Returns the Python character set for current connection
|
| This property returns the character set name of the current connection.
| Note that, unlike property charset, this checks if the previously set
| character set is supported by Python and if not, it returns the
| equivalent character set that Python supports.
|
| Returns a string.
|
| raise_on_warnings
| Get whether this connection raises an error on warnings
|
| This method returns whether this connection will raise errors when
| MySQL reports warnings.
|
| Returns True or False.
|
| server_host
| MySQL server IP address or name
|
| server_port
| MySQL server TCP/IP port
|
| sql_mode
| Get the SQL mode
|
| time_zone
| Get the current time zone
|
| unix_socket
| MySQL Unix socket file location
|
| user
| User used while connecting to MySQL
|
| ----------------------------------------------------------------------
| Data descriptors inherited from mysql.connector.abstracts.MySQLConnectionAbstract:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)

class CharacterSet(_Constants)
| MySQL supported character sets and collations
|
| List of character sets with their collations supported by MySQL. This
| maps to the character set we get from the server within the handshake
| packet.
|
| The list is hardcode so we avoid a database query when getting the
| name of the used character set or collation.
|
| Method resolution order:
| CharacterSet
| _Constants
| builtins.object
|
| Class methods defined here:
|
| get_charset_info(charset=None, collation=None) from builtins.type
| Get character set information using charset name and/or collation
|
| Retrieves character set and collation information given character
| set name and/or a collation name.
| If charset is an integer, it will look up the character set based
| on the MySQL's ID.
| For example:
| get_charset_info('utf8',None)
| get_charset_info(collation='utf8_general_ci')
| get_charset_info(47)
|
| Raises ProgrammingError when character set is not supported.
|
| Returns a tuple with (id, characterset name, collation)
|
| get_default_collation(charset) from builtins.type
| Retrieves the default collation for given character set
|
| Raises ProgrammingError when character set is not supported.
|
| Returns list (collation, charset, index)
|
| get_desc(name) from builtins.type
| Retrieves character set information as string using an ID
|
| Retrieves character set and collation information based on the
| given MySQL ID.
|
| Returns a tuple.
|
| get_info(setid) from builtins.type
| Retrieves character set information as tuple using an ID
|
| Retrieves character set and collation information based on the
| given MySQL ID.
|
| Raises ProgrammingError when character set is not supported.
|
| Returns a tuple.
|
| get_supported() from builtins.type
| Retrieves a list with names of all supproted character sets
|
| Returns a tuple.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| desc = [None, ('big5', 'big5_chinese_ci', True), ('latin2', 'latin2_cz...
|
| slash_charsets = (1, 13, 28, 84, 87, 88)
|
| ----------------------------------------------------------------------
| Class methods inherited from _Constants:
|
| get_full_info() from builtins.type
| get full information about given constant
|
| ----------------------------------------------------------------------
| Static methods inherited from _Constants:
|
| __new__(cls)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _Constants:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from _Constants:
|
| prefix = ''

class ClientFlag(_Flags)
| MySQL Client Flags
|
| Client options as found in the MySQL sources mysql-src/include/mysql_com.h
|
| Method resolution order:
| ClientFlag
| _Flags
| _Constants
| builtins.object
|
| Class methods defined here:
|
| get_default() from builtins.type
| Get the default client options set
|
| Returns a flag with all the default client options set
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| CAN_HANDLE_EXPIRED_PASSWORDS = 4194304
|
| COMPRESS = 32
|
| CONNECT_ARGS = 1048576
|
| CONNECT_WITH_DB = 8
|
| DEPRECATE_EOF = 16777216
|
| FOUND_ROWS = 2
|
| IGNORE_SIGPIPE = 4096
|
| IGNORE_SPACE = 256
|
| INTERACTIVE = 1024
|
| LOCAL_FILES = 128
|
| LONG_FLAG = 4
|
| LONG_PASSWD = 1
|
| MULTI_RESULTS = 131072
|
| MULTI_STATEMENTS = 65536
|
| NO_SCHEMA = 16
|
| ODBC = 64
|
| PLUGIN_AUTH = 524288
|
| PLUGIN_AUTH_LENENC_CLIENT_DATA = 2097152
|
| PROTOCOL_41 = 512
|
| PS_MULTI_RESULTS = 262144
|
| REMEMBER_OPTIONS = 2147483648
|
| RESERVED = 16384
|
| SECURE_CONNECTION = 32768
|
| SESION_TRACK = 8388608
|
| SSL = 2048
|
| SSL_VERIFY_SERVER_CERT = 1073741824
|
| TRANSACTIONS = 8192
|
| default = [1, 4, 8, 512, 8192, 32768, 65536, 131072]
|
| desc = {'CAN_HANDLE_EXPIRED_PASSWORDS': (4194304, "Don't close the con...
|
| ----------------------------------------------------------------------
| Class methods inherited from _Flags:
|
| get_bit_info(value) from builtins.type
| Get the name of all bits set
|
| Returns a list of strings.
|
| ----------------------------------------------------------------------
| Class methods inherited from _Constants:
|
| get_desc(name) from builtins.type
| Get description of given constant
|
| get_full_info() from builtins.type
| get full information about given constant
|
| get_info(setid) from builtins.type
| Get information about given constant
|
| ----------------------------------------------------------------------
| Static methods inherited from _Constants:
|
| __new__(cls)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _Constants:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from _Constants:
|
| prefix = ''

class DataError(DatabaseError)
| DataError(msg=None, errno=None, values=None, sqlstate=None)
|
| Exception for errors reporting problems with processed data
|
| Method resolution order:
| DataError
| DatabaseError
| Error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods inherited from Error:
|
| __init__(self, msg=None, errno=None, values=None, sqlstate=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Error:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args

class DatabaseError(Error)
| DatabaseError(msg=None, errno=None, values=None, sqlstate=None)
|
| Exception for errors related to the database
|
| Method resolution order:
| DatabaseError
| Error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods inherited from Error:
|
| __init__(self, msg=None, errno=None, values=None, sqlstate=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Error:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args

Date = class date(builtins.object)
| date(year, month, day) --> date object
|
| Methods defined here:
|
| __add__(self, value, /)
| Return self+value.
|
| __eq__(self, value, /)
| Return self==value.
|
| __format__(...)
| Formats self with strftime.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __radd__(self, value, /)
| Return value+self.
|
| __reduce__(...)
| __reduce__() -> (cls, state)
|
| __repr__(self, /)
| Return repr(self).
|
| __rsub__(self, value, /)
| Return value-self.
|
| __str__(self, /)
| Return str(self).
|
| __sub__(self, value, /)
| Return self-value.
|
| ctime(...)
| Return ctime() style string.
|
| isocalendar(...)
| Return a 3-tuple containing ISO year, week number, and weekday.
|
| isoformat(...)
| Return string in ISO 8601 format, YYYY-MM-DD.
|
| isoweekday(...)
| Return the day of the week represented by the date.
| Monday == 1 ... Sunday == 7
|
| replace(...)
| Return date with new specified fields.
|
| strftime(...)
| format -> strftime() style string.
|
| timetuple(...)
| Return time tuple, compatible with time.localtime().
|
| toordinal(...)
| Return proleptic Gregorian ordinal. January 1 of year 1 is day 1.
|
| weekday(...)
| Return the day of the week represented by the date.
| Monday == 0 ... Sunday == 6
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromisoformat(...) from builtins.type
| str -> Construct a date from the output of date.isoformat()
|
| fromordinal(...) from builtins.type
| int -> date corresponding to a proleptic Gregorian ordinal.
|
| fromtimestamp(...) from builtins.type
| timestamp -> local date from a POSIX timestamp (like time.time()).
|
| today(...) from builtins.type
| Current date or datetime: same as self.__class__.fromtimestamp(time.time()).
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| day
|
| month
|
| year
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| max = datetime.date(9999, 12, 31)
|
| min = datetime.date(1, 1, 1)
|
| resolution = datetime.timedelta(days=1)

class Error(builtins.Exception)
| Error(msg=None, errno=None, values=None, sqlstate=None)
|
| Exception that is base class for all other error exceptions
|
| Method resolution order:
| Error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods defined here:
|
| __init__(self, msg=None, errno=None, values=None, sqlstate=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args

class FieldFlag(_Flags)
| MySQL Field Flags
|
| Field flags as found in MySQL sources mysql-src/include/mysql_com.h
|
| Method resolution order:
| FieldFlag
| _Flags
| _Constants
| builtins.object
|
| Data and other attributes defined here:
|
| AUTO_INCREMENT = 512
|
| BINARY = 128
|
| BINCMP = 131072
|
| BLOB = 16
|
| ENUM = 256
|
| FIELD_IN_ADD_INDEX = 1048576
|
| FIELD_IN_PART_FUNC = 524288
|
| FIELD_IS_RENAMED = 2097152
|
| GET_FIXED_FIELDS = 262144
|
| GROUP = 16384
|
| MULTIPLE_KEY = 8
|
| NOT_NULL = 1
|
| NO_DEFAULT_VALUE = 4096
|
| NUM = 16384
|
| ON_UPDATE_NOW = 8192
|
| PART_KEY = 32768
|
| PRI_KEY = 2
|
| SET = 2048
|
| TIMESTAMP = 1024
|
| UNIQUE = 65536
|
| UNIQUE_KEY = 4
|
| UNSIGNED = 32
|
| ZEROFILL = 64
|
| desc = {'AUTO_INCREMENT': (512, 'field is a autoincrement field'), 'BI...
|
| ----------------------------------------------------------------------
| Class methods inherited from _Flags:
|
| get_bit_info(value) from builtins.type
| Get the name of all bits set
|
| Returns a list of strings.
|
| ----------------------------------------------------------------------
| Class methods inherited from _Constants:
|
| get_desc(name) from builtins.type
| Get description of given constant
|
| get_full_info() from builtins.type
| get full information about given constant
|
| get_info(setid) from builtins.type
| Get information about given constant
|
| ----------------------------------------------------------------------
| Static methods inherited from _Constants:
|
| __new__(cls)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _Constants:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from _Constants:
|
| prefix = ''

class FieldType(_Constants)
| MySQL Field Types
|
| Method resolution order:
| FieldType
| _Constants
| builtins.object
|
| Class methods defined here:
|
| get_binary_types() from builtins.type
| Get the list of all binary types
|
| get_number_types() from builtins.type
| Get the list of all number types
|
| get_string_types() from builtins.type
| Get the list of all string types
|
| get_timestamp_types() from builtins.type
| Get the list of all timestamp types
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| BIT = 16
|
| BLOB = 252
|
| DATE = 10
|
| DATETIME = 12
|
| DECIMAL = 0
|
| DOUBLE = 5
|
| ENUM = 247
|
| FLOAT = 4
|
| GEOMETRY = 255
|
| INT24 = 9
|
| JSON = 245
|
| LONG = 3
|
| LONGLONG = 8
|
| LONG_BLOB = 251
|
| MEDIUM_BLOB = 250
|
| NEWDATE = 14
|
| NEWDECIMAL = 246
|
| NULL = 6
|
| SET = 248
|
| SHORT = 2
|
| STRING = 254
|
| TIME = 11
|
| TIMESTAMP = 7
|
| TINY = 1
|
| TINY_BLOB = 249
|
| VARCHAR = 15
|
| VAR_STRING = 253
|
| YEAR = 13
|
| desc = {'BIT': (16, 'BIT'), 'BLOB': (252, 'BLOB'), 'DATE': (10, 'DATE'...
|
| prefix = 'FIELD_TYPE_'
|
| ----------------------------------------------------------------------
| Class methods inherited from _Constants:
|
| get_desc(name) from builtins.type
| Get description of given constant
|
| get_full_info() from builtins.type
| get full information about given constant
|
| get_info(setid) from builtins.type
| Get information about given constant
|
| ----------------------------------------------------------------------
| Static methods inherited from _Constants:
|
| __new__(cls)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _Constants:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)

class IntegrityError(DatabaseError)
| IntegrityError(msg=None, errno=None, values=None, sqlstate=None)
|
| Exception for errors regarding relational integrity
|
| Method resolution order:
| IntegrityError
| DatabaseError
| Error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods inherited from Error:
|
| __init__(self, msg=None, errno=None, values=None, sqlstate=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Error:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args

class InterfaceError(Error)
| InterfaceError(msg=None, errno=None, values=None, sqlstate=None)
|
| Exception for errors related to the interface
|
| Method resolution order:
| InterfaceError
| Error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods inherited from Error:
|
| __init__(self, msg=None, errno=None, values=None, sqlstate=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Error:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args

class InternalError(DatabaseError)
| InternalError(msg=None, errno=None, values=None, sqlstate=None)
|
| Exception for errors internal database errors
|
| Method resolution order:
| InternalError
| DatabaseError
| Error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods inherited from Error:
|
| __init__(self, msg=None, errno=None, values=None, sqlstate=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Error:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args

class MySQLConnection(mysql.connector.abstracts.MySQLConnectionAbstract)
| MySQLConnection(*args, **kwargs)
|
| Connection to a MySQL Server
|
| Method resolution order:
| MySQLConnection
| mysql.connector.abstracts.MySQLConnectionAbstract
| mysql.connector.abstracts.MySQLConnectionAbstract
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args, **kwargs)
| Initialize
|
| close(self)
| Disconnect from the MySQL server
|
| cmd_change_user(self, username='', password='', database='', charset=45)
| Change the current logged in user
|
| This method allows to change the current logged in user information.
| The result is a dictionary with OK packet information.
|
| Returns a dict()
|
| cmd_debug(self)
| Send the DEBUG command
|
| This method sends the DEBUG command to the MySQL server, which
| requires the MySQL user to have SUPER privilege. The output will go
| to the MySQL server error log and the result of this method is a
| dictionary with EOF packet information.
|
| Returns a dict()
|
| cmd_init_db(self, database)
| Change the current database
|
| This method changes the current (default) database by sending the
| INIT_DB command. The result is a dictionary containing the OK packet
| information.
|
| Returns a dict()
|
| cmd_ping(self)
| Send the PING command
|
| This method sends the PING command to the MySQL server. It is used to
| check if the the connection is still valid. The result of this
| method is dictionary with OK packet information.
|
| Returns a dict()
|
| cmd_process_kill(self, mysql_pid)
| Kill a MySQL process
|
| This method send the PROCESS_KILL command to the server along with
| the process ID. The result is a dictionary with the OK packet
| information.
|
| Returns a dict()
|
| cmd_query(self, query, raw=False, buffered=False, raw_as_string=False)
| Send a query to the MySQL server
|
| This method send the query to the MySQL server and returns the result.
|
| If there was a text result, a tuple will be returned consisting of
| the number of columns and a list containing information about these
| columns.
|
| When the query doesn't return a text result, the OK or EOF packet
| information as dictionary will be returned. In case the result was
| an error, exception errors.Error will be raised.
|
| Returns a tuple()
|
| cmd_query_iter(self, statements)
| Send one or more statements to the MySQL server
|
| Similar to the cmd_query method, but instead returns a generator
| object to iterate through results. It sends the statements to the
| MySQL server and through the iterator you can get the results.
|
| statement = 'SELECT 1; INSERT INTO t1 VALUES (); SELECT 2'
| for result in cnx.cmd_query(statement, iterate=True):
| if 'columns' in result:
| columns = result['columns']
| rows = cnx.get_rows()
| else:
| # do something useful with INSERT result
|
| Returns a generator.
|
| cmd_quit(self)
| Close the current connection with the server
|
| This method sends the QUIT command to the MySQL server, closing the
| current connection. Since the no response can be returned to the
| client, cmd_quit() will return the packet it send.
|
| Returns a str()
|
| cmd_refresh(self, options)
| Send the Refresh command to the MySQL server
|
| This method sends the Refresh command to the MySQL server. The options
| argument should be a bitwise value using constants.RefreshOption.
| Usage example:
| RefreshOption = mysql.connector.RefreshOption
| refresh = RefreshOption.LOG | RefreshOption.THREADS
| cnx.cmd_refresh(refresh)
|
| The result is a dictionary with the OK packet information.
|
| Returns a dict()
|
| cmd_reset_connection(self)
| Resets the session state without re-authenticating
|
| Works only for MySQL server 5.7.3 or later.
| The result is a dictionary with OK packet information.
|
| Returns a dict()
|
| cmd_shutdown(self, shutdown_type=None)
| Shut down the MySQL Server
|
| This method sends the SHUTDOWN command to the MySQL server and is only
| possible if the current user has SUPER privileges. The result is a
| dictionary containing the OK packet information.
|
| Note: Most applications and scripts do not the SUPER privilege.
|
| Returns a dict()
|
| cmd_statistics(self)
| Send the statistics command to the MySQL Server
|
| This method sends the STATISTICS command to the MySQL server. The
| result is a dictionary with various statistical information.
|
| Returns a dict()
|
| cmd_stmt_close(self, statement_id)
| Deallocate a prepared MySQL statement
|
| This method deallocates the prepared statement using the
| statement_id. Note that the MySQL server does not return
| anything.
|
| cmd_stmt_execute(self, statement_id, data=(), parameters=(), flags=0)
| Execute a prepared MySQL statement
|
| cmd_stmt_fetch(self, statement_id, rows=1)
| Fetch a MySQL statement Result Set
|
| This method will send the FETCH command to MySQL together with the
| given statement id and the number of rows to fetch.
|
| cmd_stmt_prepare(self, statement)
| Prepare a MySQL statement
|
| This method will send the PREPARE command to MySQL together with the
| given statement.
|
| Returns a dict()
|
| cmd_stmt_reset(self, statement_id)
| Reset data for prepared statement sent as long data
|
| The result is a dictionary with OK packet information.
|
| Returns a dict()
|
| cmd_stmt_send_long_data(self, statement_id, param_id, data)
| Send data for a column
|
| This methods send data for a column (for example BLOB) for statement
| identified by statement_id. The param_id indicate which parameter
| the data belongs too.
| The data argument should be a file-like object.
|
| Since MySQL does not send anything back, no error is raised. When
| the MySQL server is not reachable, an OperationalError is raised.
|
| cmd_stmt_send_long_data should be called before cmd_stmt_execute.
|
| The total bytes send is returned.
|
| Returns int.
|
| commit(self)
| Commit current transaction
|
| consume_results(self)
| Consume results
|
| cursor(self, buffered=None, raw=None, prepared=None, cursor_class=None, dictionary=None, named_tuple=None)
| Instantiates and returns a cursor
|
| By default, MySQLCursor is returned. Depending on the options
| while connecting, a buffered and/or raw cursor is instantiated
| instead. Also depending upon the cursor options, rows can be
| returned as dictionary or named tuple.
|
| Dictionary and namedtuple based cursors are available with buffered
| output but not raw.
|
| It is possible to also give a custom cursor through the
| cursor_class parameter, but it needs to be a subclass of
| mysql.connector.cursor.CursorBase.
|
| Raises ProgrammingError when cursor_class is not a subclass of
| CursorBase. Raises ValueError when cursor is not available.
|
| Returns a cursor-object
|
| disconnect = close(self)
|
| get_row(self, binary=False, columns=None, raw=None)
| Get the next rows returned by the MySQL server
|
| This method gets one row from the result set after sending, for
| example, the query command. The result is a tuple consisting of the
| row and the EOF packet.
| If no row was available in the result set, the row data will be None.
|
| Returns a tuple.
|
| get_rows(self, count=None, binary=False, columns=None, raw=None)
| Get all rows returned by the MySQL server
|
| This method gets all rows returned by the MySQL server after sending,
| for example, the query command. The result is a tuple consisting of
| a list of rows and the EOF packet.
|
| Returns a tuple()
|
| handle_unread_result(self)
| Check whether there is an unread result
|
| info_query(self, query)
| Send a query which only returns 1 row
|
| is_connected(self)
| Reports whether the connection to MySQL Server is available
|
| This method checks whether the connection to MySQL is available.
| It is similar to ping(), but unlike the ping()-method, either True
| or False is returned and no exception is raised.
|
| Returns True or False.
|
| ping(self, reconnect=False, attempts=1, delay=0)
| Check availability of the MySQL server
|
| When reconnect is set to True, one or more attempts are made to try
| to reconnect to the MySQL server using the reconnect()-method.
|
| delay is the number of seconds to wait between each retry.
|
| When the connection is not available, an InterfaceError is raised. Use
| the is_connected()-method if you just want to check the connection
| without raising an error.
|
| Raises InterfaceError on errors.
|
| reconnect(self, attempts=1, delay=0)
| Attempt to reconnect to the MySQL server
|
| The argument attempts should be the number of times a reconnect
| is tried. The delay argument is the number of seconds to wait between
| each retry.
|
| You may want to set the number of attempts higher and use delay when
| you expect the MySQL server to be down for maintenance or when you
| expect the network to be temporary unavailable.
|
| Raises InterfaceError on errors.
|
| reset_session(self, user_variables=None, session_variables=None)
| Clears the current active session
|
| This method resets the session state, if the MySQL server is 5.7.3
| or later active session will be reset without re-authenticating.
| For other server versions session will be reset by re-authenticating.
|
| It is possible to provide a sequence of variables and their values to
| be set after clearing the session. This is possible for both user
| defined variables and session variables.
| This method takes two arguments user_variables and session_variables
| which are dictionaries.
|
| Raises OperationalError if not connected, InternalError if there are
| unread results and InterfaceError on errors.
|
| rollback(self)
| Rollback current transaction
|
| shutdown(self)
| Shut down connection to MySQL Server.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| connection_id
| MySQL connection ID
|
| database
| Get the current database
|
| in_transaction
| MySQL session has started a transaction
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __abstractmethods__ = frozenset()
|
| ----------------------------------------------------------------------
| Methods inherited from mysql.connector.abstracts.MySQLConnectionAbstract:
|
| cmd_process_info(self)
| Get the process list of the MySQL Server
|
| This method is a placeholder to notify that the PROCESS_INFO command
| is not supported by raising the NotSupportedError. The command
| "SHOW PROCESSLIST" should be send using the cmd_query()-method or
| using the INFORMATION_SCHEMA database.
|
| Raises NotSupportedError exception
|
| config(self, **kwargs)
| Configure the MySQL Connection
|
| This method allows you to configure the MySQLConnection instance.
|
| Raises on errors.
|
| connect(self, **kwargs)
| Connect to the MySQL server
|
| This method sets up the connection to the MySQL server. If no
| arguments are given, it will use the already configured or default
| values.
|
| get_server_info(self)
| Get the original MySQL version information
|
| This method returns the original MySQL server as text. If not
| previously connected, it will return None.
|
| Returns a string or None.
|
| get_server_version(self)
| Get the MySQL version
|
| This method returns the MySQL server version as a tuple. If not
| previously connected, it will return None.
|
| Returns a tuple or None.
|
| isset_client_flag(self, flag)
| Check if a client flag is set
|
| set_charset_collation(self, charset=None, collation=None)
| Sets the character set and collation for the current connection
|
| This method sets the character set and collation to be used for
| the current connection. The charset argument can be either the
| name of a character set as a string, or the numerical equivalent
| as defined in constants.CharacterSet.
|
| When the collation is not given, the default will be looked up and
| used.
|
| For example, the following will set the collation for the latin1
| character set to latin1_general_ci:
|
| set_charset('latin1','latin1_general_ci')
|
| set_client_flags(self, flags)
| Set the client flags
|
| The flags-argument can be either an int or a list (or tuple) of
| ClientFlag-values. If it is an integer, it will set client_flags
| to flags as is.
| If flags is a list (or tuple), each flag will be set or unset
| when it's negative.
|
| set_client_flags([ClientFlag.FOUND_ROWS,-ClientFlag.LONG_FLAG])
|
| Raises ProgrammingError when the flags argument is not a set or
| an integer bigger than 0.
|
| Returns self.client_flags
|
| set_converter_class(self, convclass)
| Set the converter class to be used. This should be a class overloading
| methods and members of conversion.MySQLConverter.
|
| set_login(self, username=None, password=None)
| Set login information for MySQL
|
| Set the username and/or password for the user connecting to
| the MySQL Server.
|
| set_unicode(self, value=True)
| Toggle unicode mode
|
| Set whether we return string fields as unicode or not.
| Default is True.
|
| start_transaction(self, consistent_snapshot=False, isolation_level=None, readonly=None)
| Start a transaction
|
| This method explicitly starts a transaction sending the
| START TRANSACTION statement to the MySQL server. You can optionally
| set whether there should be a consistent snapshot, which
| isolation level you need or which access mode i.e. READ ONLY or
| READ WRITE.
|
| For example, to start a transaction with isolation level SERIALIZABLE,
| you would do the following:
| >>> cnx = mysql.connector.connect(..)
| >>> cnx.start_transaction(isolation_level='SERIALIZABLE')
|
| Raises ProgrammingError when a transaction is already in progress
| and when ValueError when isolation_level specifies an Unknown
| level.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from mysql.connector.abstracts.MySQLConnectionAbstract:
|
| autocommit
| Get whether autocommit is on or off
|
| can_consume_results
| Returns whether to consume results
|
| charset
| Returns the character set for current connection
|
| This property returns the character set name of the current connection.
| The server is queried when the connection is active. If not connected,
| the configured character set name is returned.
|
| Returns a string.
|
| collation
| Returns the collation for current connection
|
| This property returns the collation name of the current connection.
| The server is queried when the connection is active. If not connected,
| the configured collation name is returned.
|
| Returns a string.
|
| get_warnings
| Get whether this connection retrieves warnings automatically
|
| This method returns whether this connection retrieves warnings
| automatically.
|
| Returns True, or False when warnings are not retrieved.
|
| python_charset
| Returns the Python character set for current connection
|
| This property returns the character set name of the current connection.
| Note that, unlike property charset, this checks if the previously set
| character set is supported by Python and if not, it returns the
| equivalent character set that Python supports.
|
| Returns a string.
|
| raise_on_warnings
| Get whether this connection raises an error on warnings
|
| This method returns whether this connection will raise errors when
| MySQL reports warnings.
|
| Returns True or False.
|
| server_host
| MySQL server IP address or name
|
| server_port
| MySQL server TCP/IP port
|
| sql_mode
| Get the SQL mode
|
| time_zone
| Get the current time zone
|
| unix_socket
| MySQL Unix socket file location
|
| unread_result
| Get whether there is an unread result
|
| This method is used by cursors to check whether another cursor still
| needs to retrieve its result set.
|
| Returns True, or False when there is no unread result.
|
| user
| User used while connecting to MySQL
|
| ----------------------------------------------------------------------
| Data descriptors inherited from mysql.connector.abstracts.MySQLConnectionAbstract:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)

class NotSupportedError(DatabaseError)
| NotSupportedError(msg=None, errno=None, values=None, sqlstate=None)
|
| Exception for errors when an unsupported database feature was used
|
| Method resolution order:
| NotSupportedError
| DatabaseError
| Error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods inherited from Error:
|
| __init__(self, msg=None, errno=None, values=None, sqlstate=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Error:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args

class OperationalError(DatabaseError)
| OperationalError(msg=None, errno=None, values=None, sqlstate=None)
|
| Exception for errors related to the database's operation
|
| Method resolution order:
| OperationalError
| DatabaseError
| Error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods inherited from Error:
|
| __init__(self, msg=None, errno=None, values=None, sqlstate=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Error:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args

class ProgrammingError(DatabaseError)
| ProgrammingError(msg=None, errno=None, values=None, sqlstate=None)
|
| Exception for errors programming errors
|
| Method resolution order:
| ProgrammingError
| DatabaseError
| Error
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Methods inherited from Error:
|
| __init__(self, msg=None, errno=None, values=None, sqlstate=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| __str__(self)
| Return str(self).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from Error:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args

class RefreshOption(_Constants)
| MySQL Refresh command options
|
| Options used when sending the COM_REFRESH server command.
|
| Method resolution order:
| RefreshOption
| _Constants
| builtins.object
|
| Data and other attributes defined here:
|
| GRANT = 1
|
| HOST = 8
|
| LOG = 2
|
| SLAVE = 64
|
| STATUS = 16
|
| TABLES = 4
|
| THREADS = 32
|
| desc = {'GRANT': (1, 'Refresh grant tables'), 'HOSTS': (8, 'Flush host...
|
| ----------------------------------------------------------------------
| Class methods inherited from _Constants:
|
| get_desc(name) from builtins.type
| Get description of given constant
|
| get_full_info() from builtins.type
| get full information about given constant
|
| get_info(setid) from builtins.type
| Get information about given constant
|
| ----------------------------------------------------------------------
| Static methods inherited from _Constants:
|
| __new__(cls)
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from _Constants:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from _Constants:
|
| prefix = ''

Time = class time(builtins.object)
| time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object
|
| All arguments are optional. tzinfo may be None, or an instance of
| a tzinfo subclass. The remaining arguments may be ints.
|
| Methods defined here:
|
| __eq__(self, value, /)
| Return self==value.
|
| __format__(...)
| Formats self with strftime.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __reduce__(...)
| __reduce__() -> (cls, state)
|
| __reduce_ex__(...)
| __reduce_ex__(proto) -> (cls, state)
|
| __repr__(self, /)
| Return repr(self).
|
| __str__(self, /)
| Return str(self).
|
| dst(...)
| Return self.tzinfo.dst(self).
|
| isoformat(...)
| Return string in ISO 8601 format, [HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].
|
| timespec specifies what components of the time to include.
|
| replace(...)
| Return time with new specified fields.
|
| strftime(...)
| format -> strftime() style string.
|
| tzname(...)
| Return self.tzinfo.tzname(self).
|
| utcoffset(...)
| Return self.tzinfo.utcoffset(self).
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| fromisoformat(...) from builtins.type
| string -> time from time.isoformat() output
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| fold
|
| hour
|
| microsecond
|
| minute
|
| second
|
| tzinfo
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| max = datetime.time(23, 59, 59, 999999)
|
| min = datetime.time(0, 0)
|
| resolution = datetime.timedelta(microseconds=1)

Timestamp = class datetime(date)
| datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
|
| The year, month and day arguments are required. tzinfo may be None, or an
| instance of a tzinfo subclass. The remaining arguments may be ints.
|
| Method resolution order:
| datetime
| date
| builtins.object
|
| Methods defined here:
|
| __add__(self, value, /)
| Return self+value.
|
| __eq__(self, value, /)
| Return self==value.
|
| __ge__(self, value, /)
| Return self>=value.
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __gt__(self, value, /)
| Return self>value.
|
| __hash__(self, /)
| Return hash(self).
|
| __le__(self, value, /)
| Return self<=value.
|
| __lt__(self, value, /)
| Return self<value.
|
| __ne__(self, value, /)
| Return self!=value.
|
| __radd__(self, value, /)
| Return value+self.
|
| __reduce__(...)
| __reduce__() -> (cls, state)
|
| __reduce_ex__(...)
| __reduce_ex__(proto) -> (cls, state)
|
| __repr__(self, /)
| Return repr(self).
|
| __rsub__(self, value, /)
| Return value-self.
|
| __str__(self, /)
| Return str(self).
|
| __sub__(self, value, /)
| Return self-value.
|
| astimezone(...)
| tz -> convert to local time in new timezone tz
|
| ctime(...)
| Return ctime() style string.
|
| date(...)
| Return date object with same year, month and day.
|
| dst(...)
| Return self.tzinfo.dst(self).
|
| isoformat(...)
| [sep] -> string in ISO 8601 format, YYYY-MM-DDT[HH[:MM[:SS[.mmm[uuu]]]]][+HH:MM].
| sep is used to separate the year from the time, and defaults to 'T'.
| timespec specifies what components of the time to include (allowed values are 'auto', 'hours', 'minutes', 'seconds', 'milliseconds', and 'microseconds').
|
| replace(...)
| Return datetime with new specified fields.
|
| time(...)
| Return time object with same time but with tzinfo=None.
|
| timestamp(...)
| Return POSIX timestamp as float.
|
| timetuple(...)
| Return time tuple, compatible with time.localtime().
|
| timetz(...)
| Return time object with same time and tzinfo.
|
| tzname(...)
| Return self.tzinfo.tzname(self).
|
| utcoffset(...)
| Return self.tzinfo.utcoffset(self).
|
| utctimetuple(...)
| Return UTC time tuple, compatible with time.localtime().
|
| ----------------------------------------------------------------------
| Class methods defined here:
|
| combine(...) from builtins.type
| date, time -> datetime with same date and time fields
|
| fromisoformat(...) from builtins.type
| string -> datetime from datetime.isoformat() output
|
| fromtimestamp(...) from builtins.type
| timestamp[, tz] -> tz's local time from POSIX timestamp.
|
| now(tz=None) from builtins.type
| Returns new datetime object representing current time local to tz.
|
| tz
| Timezone object.
|
| If no tz is specified, uses local timezone.
|
| strptime(...) from builtins.type
| string, format -> new datetime parsed from a string (like time.strptime()).
|
| utcfromtimestamp(...) from builtins.type
| Construct a naive UTC datetime from a POSIX timestamp.
|
| utcnow(...) from builtins.type
| Return a new datetime representing UTC day and time.
|
| ----------------------------------------------------------------------
| Static methods defined here:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| fold
|
| hour
|
| microsecond
|
| minute
|
| second
|
| tzinfo
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| max = datetime.datetime(9999, 12, 31, 23, 59, 59, 999999)
|
| min = datetime.datetime(1, 1, 1, 0, 0)
|
| resolution = datetime.timedelta(microseconds=1)
|
| ----------------------------------------------------------------------
| Methods inherited from date:
|
| __format__(...)
| Formats self with strftime.
|
| isocalendar(...)
| Return a 3-tuple containing ISO year, week number, and weekday.
|
| isoweekday(...)
| Return the day of the week represented by the date.
| Monday == 1 ... Sunday == 7
|
| strftime(...)
| format -> strftime() style string.
|
| toordinal(...)
| Return proleptic Gregorian ordinal. January 1 of year 1 is day 1.
|
| weekday(...)
| Return the day of the week represented by the date.
| Monday == 0 ... Sunday == 6
|
| ----------------------------------------------------------------------
| Class methods inherited from date:
|
| fromordinal(...) from builtins.type
| int -> date corresponding to a proleptic Gregorian ordinal.
|
| today(...) from builtins.type
| Current date or datetime: same as self.__class__.fromtimestamp(time.time()).
|
| ----------------------------------------------------------------------
| Data descriptors inherited from date:
|
| day
|
| month
|
| year

class Warning(builtins.Exception)
| Exception for important warnings
|
| Method resolution order:
| Warning
| builtins.Exception
| builtins.BaseException
| builtins.object
|
| Data descriptors defined here:
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.Exception:
|
| __init__(self, /, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| ----------------------------------------------------------------------
| Static methods inherited from builtins.Exception:
|
| __new__(*args, **kwargs) from builtins.type
| Create and return a new object. See help(type) for accurate signature.
|
| ----------------------------------------------------------------------
| Methods inherited from builtins.BaseException:
|
| __delattr__(self, name, /)
| Implement delattr(self, name).
|
| __getattribute__(self, name, /)
| Return getattr(self, name).
|
| __reduce__(...)
| Helper for pickle.
|
| __repr__(self, /)
| Return repr(self).
|
| __setattr__(self, name, value, /)
| Implement setattr(self, name, value).
|
| __setstate__(...)
|
| __str__(self, /)
| Return str(self).
|
| with_traceback(...)
| Exception.with_traceback(tb) --
| set self.__traceback__ to tb and return self.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from builtins.BaseException:
|
| __cause__
| exception cause
|
| __context__
| exception context
|
| __dict__
|
| __suppress_context__
|
| __traceback__
|
| args

## FUNCTIONS
Connect = connect(*args, **kwargs)
Create or get a MySQL connection object

In its simpliest form, Connect() will open a connection to a
MySQL server and return a MySQLConnection object.

When any connection pooling arguments are given, for example pool_name
or pool_size, a pool is created or a previously one is used to return
a PooledMySQLConnection.

Returns MySQLConnection or PooledMySQLConnection.

DateFromTicks(ticks)

TimeFromTicks(ticks)

TimestampFromTicks(ticks)

connect(*args, **kwargs)
Create or get a MySQL connection object

In its simpliest form, Connect() will open a connection to a
MySQL server and return a MySQLConnection object.

When any connection pooling arguments are given, for example pool_name
or pool_size, a pool is created or a previously one is used to return
a PooledMySQLConnection.

Returns MySQLConnection or PooledMySQLConnection.

custom_error_exception(error=None, exception=None)
Define custom exceptions for MySQL server errors

This function defines custom exceptions for MySQL server errors and
returns the current set customizations.

If error is a MySQL Server error number, then you have to pass also the
exception class.

The error argument can also be a dictionary in which case the key is
the server error number, and value the exception to be raised.

If none of the arguments are given, then custom_error_exception() will
simply return the current set customizations.

To reset the customizations, simply supply an empty dictionary.

Examples:
import mysql.connector
from mysql.connector import errorcode

# Server error 1028 should raise a DatabaseError
mysql.connector.custom_error_exception(
1028, mysql.connector.DatabaseError)

# Or using a dictionary:
mysql.connector.custom_error_exception({
1028: mysql.connector.DatabaseError,
1029: mysql.connector.OperationalError,
})

# Reset
mysql.connector.custom_error_exception({})

Returns a dictionary.

DATA

1
2
3
4
5
6
7
8
9
10
11
BINARY = <mysql.connector.dbapi._DBAPITypeObject object>
DATETIME = <mysql.connector.dbapi._DBAPITypeObject object>
HAVE_CEXT = True
NUMBER = <mysql.connector.dbapi._DBAPITypeObject object>
ROWID = <mysql.connector.dbapi._DBAPITypeObject object>
STRING = <mysql.connector.dbapi._DBAPITypeObject object>
__all__ = ['MySQLConnection', 'Connect', 'custom_error_exception', 'Fi...
__version_info__ = (8, 0, 16, '', 1)
apilevel = '2.0'
paramstyle = 'pyformat'
threadsafety = 1

VERSION

1
8.0.16

FILE

1
/home/shelling/env/lib/python3.7/site-packages/mysql/connector/__init__.py