You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
713 B
28 lines
713 B
import pymysql |
|
from pymysql.cursors import DictCursor |
|
|
|
|
|
class WandaDb: |
|
def __init__(self): |
|
self.db_config = { |
|
'host': '192.168.55.99', |
|
'user': 'dbadmin', |
|
'password': 'fXMSR37mLP7w88ji', |
|
'database': 'cine' |
|
} |
|
|
|
def connect_db(self): |
|
db = pymysql.connect(**self.db_config) |
|
return db |
|
|
|
|
|
if __name__ == "__main__": |
|
d = WandaDb().connect_db() |
|
c = d.cursor(cursor=DictCursor) |
|
c.execute("SELECT * FROM cinema_version;") |
|
print(c.fetchall()) |
|
sql_str = "SELECT * FROM booking_sale_detail;" |
|
c.execute(sql_str) |
|
for d in c.fetchall(): |
|
if d['RETAIL_SALE_DATE'] == d['BIZ_DATE']: |
|
print(d['id'])
|
|
|