Search Results
                    
                    
            https://dev.mysql.com/doc/connectors/en/connector-python-api-mysqlconnection-cmd-query-iter.html
                                The following example shows how to iterate through the results after sending multiple statements: statement = 'SELECT 1; INSERT INTO t1 VALUES (); SELECT 2' for result in cnx.cmd_query_iter(statement): if 'columns' in result: columns = ... Syntax: ...
                                            
                https://dev.mysql.com/doc/connectors/en/connector-python-api-mysqlconnection-time-zone.html
                                >>> cnx.time_zone = '+00:00' >>> cursor = cnx.cursor() >>> cursor.execute('SELECT NOW()') ; cursor.fetchone() (datetime.datetime(2012, 6, 15, 11, 24, 36),) >>> cnx.time_zone = '-09:00' >>> cursor.execute('SELECT NOW()') ; cursor.fetchone() ... This ...
                                            
                https://dev.mysql.com/doc/connectors/en/connector-python-api-mysqlcursor-execute.html
                                This example inserts information about a new employee, then selects the data for that person.  Syntax: cursor.execute(operation, params=None) iterator = cursor.execute(operation, params=None) # Allowed before 9.2.0 iterator = ...
                                            
                https://dev.mysql.com/doc/connectors/en/connector-python-api-mysqlcursor-fetchone.html
                                 Syntax: row = cursor.fetchone() This method retrieves the next row of a query result set and returns a single sequence, or None if no more rows are available. By default, the returned tuple consists of data returned by the MySQL server, converted ...
                                            
                https://dev.mysql.com/doc/connectors/en/connector-python-api-mysqlcursor-fetchsets.html
                                sql_operation = ''' SET @a=1, @b='2025-01-01'; SELECT @a, LENGTH('hello'), @b; SELECT @@version; ''' with cnx.cursor() as cur: cur.execute(sql_operation) for statement, result_set in cur.fetchsets(): # do something with statement and/or result set ... Syntax: for statement, result_set in cursor.fetchsets(): # do something with statement and/or result set This method generates a set of result sets caused by the last ...
                                            
                https://dev.mysql.com/doc/connectors/en/connector-python-api-mysqlcursor-fetchwarnings.html
                                The following example shows a SELECT statement that generates a warning: >>> cnx.get_warnings = True >>> cursor.execute("SELECT 'a'+1") >>> cursor.fetchall() [(1.0,)] >>> cursor.fetchwarnings() [(u'Warning', 1292, u"Truncated incorrect DOUBLE value: ...Syntax: tuples = cursor.fetchwarnings() This method returns a list of tuples containing warnings generated by the previously executed ...
                                            
                https://dev.mysql.com/doc/connectors/en/connector-python-api-mysqlcursor-nextset.html
                                sql_operation = ''' SET @a=1, @b='2025-01-01'; SELECT @a, LENGTH('hello'), @b; SELECT @@version; ''' with cnx.cursor() as cur: cur.execute(sql_operation) result_set = cur.fetchall() # do something with result set ...  Syntax: row = cursor.nextset() ...
                                            
                https://dev.mysql.com/doc/connectors/en/connector-python-api-mysqlcursor-warnings.html
                                The following example shows a SELECT statement that generates a warning: >>> cnx.get_warnings = True >>> cursor.execute("SELECT 'a'+1") >>> cursor.fetchall() [(1.0,)] >>> print(cursor.warnings) [(u'Warning', 1292, u"Truncated incorrect DOUBLE value: ... Syntax: tuples = cursor.warnings This property returns a list of tuples containing warnings generated by the previously executed ...
                                            
                https://dev.mysql.com/doc/connectors/en/connector-python-api-mysqlcursordict.html
                                Example: cnx = mysql.connector.connect(database='world') cursor = cnx.cursor(dictionary=True) cursor.execute("SELECT * FROM country WHERE Continent = 'Europe'") print("Countries in Europe:") for row in cursor: print("* ...The keys for each ...
                                            
                https://dev.mysql.com/doc/connectors/en/connector-python-api-mysqlcursorprepared.html
                                Example: cursor = cnx.cursor(prepared=True) stmt = "SELECT fullname FROM employees WHERE id = %s" # (1) cursor.execute(stmt, (5,)) # (2) # ... In MySQL, there are two ways to execute a prepared statement: Use the PREPARE and EXECUTE statements. To ...