修正
This commit is contained in:
10
list_accounts.py
Normal file
10
list_accounts.py
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env python3
|
||||
import psycopg
|
||||
|
||||
conn = psycopg.connect('host=localhost user=postgres password=postgres dbname=accounting')
|
||||
cur = conn.cursor()
|
||||
cur.execute('SELECT account_code, account_name FROM accounts WHERE is_active=true ORDER BY account_code')
|
||||
for row in cur.fetchall():
|
||||
print(f'{row[0]:3s} {row[1]}')
|
||||
cur.close()
|
||||
conn.close()
|
||||
Reference in New Issue
Block a user