We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Have returned rows be in dictionary form.
http://zetcode.com/python/pymysql/
eg:
#!/usr/bin/python import pymysql import pymysql.cursors con = pymysql.connect(host='localhost', user='user7', password='s$cret', db='testdb', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor) try: with con.cursor() as cur: cur.execute('SELECT * FROM cities') rows = cur.fetchall() for row in rows: print(row['id'], row['name']) finally: con.close()
The text was updated successfully, but these errors were encountered:
def Connect(self, use_cursor_dict=False): if use_cursor_dict: self.USE_CRSR_DICT = True return pymysql.connect( host=self.HOST, user=self.DBUSR, password=self.DBPSWD, db=self.DBNAME, charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor ) else: self.USE_CRSR_DICT = False return pymysql.connect( host=self.HOST, user=self.DBUSR, password=self.DBPSWD, db=self.DBNAME, charset='utf8mb4' )
Sorry, something went wrong.
No branches or pull requests
Have returned rows be in dictionary form.
http://zetcode.com/python/pymysql/
eg:
The text was updated successfully, but these errors were encountered: