32 lines
653 B
Python
32 lines
653 B
Python
#!/usr/bin/env python3
|
|
|
|
# Module Imports
|
|
import mariadb
|
|
import sys
|
|
|
|
# Connect to MariaDB Platform
|
|
try:
|
|
conn = mariadb.connect(
|
|
user="root",
|
|
password="test",
|
|
host="127.0.0.1",
|
|
port=3306,
|
|
database="test_data"
|
|
|
|
)
|
|
except mariadb.Error as e:
|
|
print(f"Error connecting to MariaDB Platform: {e}")
|
|
sys.exit(1)
|
|
|
|
# Get Cursor
|
|
cur = conn.cursor()
|
|
|
|
acc_id = int(input("Input: "))
|
|
|
|
cur.execute(f"SELECT first_name,last_name,balance,uid FROM `accounts` WHERE `uid` LIKE \"{acc_id}\"")
|
|
|
|
for (first_name, last_name, balance, uid) in cur:
|
|
print(str(uid).zfill(10), first_name, last_name, balance)
|
|
|
|
conn.close()
|