Dec-24-2017, 06:43 AM
Hi,
I read more tutorials and try use PyMySQL. I resolv some problems :
- which is the best library for SQL and MariaDB ? (I found MysqlDB, PyMySQL, SQLAlchemy)
- is ORM (SQLAlchemy) usable for simple projects ?
- I need more SQL queries in one program loop (example bellow). Must I use for each query separate connection and cursor or can use one cursor (conenction) ?
I read more tutorials and try use PyMySQL. I resolv some problems :
- which is the best library for SQL and MariaDB ? (I found MysqlDB, PyMySQL, SQLAlchemy)
- is ORM (SQLAlchemy) usable for simple projects ?
- I need more SQL queries in one program loop (example bellow). Must I use for each query separate connection and cursor or can use one cursor (conenction) ?
sql = "SELECT * FROM portal WHERE typ_id = "+str(typ) self.cursor.execute(sql) data = self.cursor.fetchall() c = self.cursor.rowcount for row in data: sql1 = "INSERT INTO values VALUES ('',NOW(),0," + str(row[0]) + ")" try: self.cursor.execute(sql1) except: self.db.rollback()