Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SQL query with MariaDB
#1
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) ?

       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()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Error using mariadb select query with form in python? shams 2 2,024 Jul-29-2021, 12:30 PM
Last Post: shams
  write mariadb table rows query to each file? shams 1 1,891 Feb-02-2021, 04:10 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020