Files
gomag-vending/api/tests/check_table_structure.py
Marius Mutu 52454a5925 Complete P1-004: Testing Manual Packages and reorganize test files
- Complete manual testing of all Oracle PL/SQL packages
- Document 75% success rate (3/4 components passing)
- Move all test scripts from api/ to api/tests/ subdirectory
- Update P1-004 story with comprehensive test results
- Identify external dependency blocking full order import
- Mark Phase 1 as 95% complete, ready for Phase 2

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 01:25:27 +03:00

72 lines
2.2 KiB
Python

#!/usr/bin/env python3
"""
Check COMENZI table structure
"""
import oracledb
import os
from dotenv import load_dotenv
load_dotenv('.env')
user = os.environ['ORACLE_USER']
password = os.environ['ORACLE_PASSWORD']
dsn = os.environ['ORACLE_DSN']
try:
instantclient_path = os.environ.get('INSTANTCLIENTPATH', '/opt/oracle/instantclient_23_9')
oracledb.init_oracle_client(lib_dir=instantclient_path)
except Exception as e:
pass
def check_table_structure():
"""Check COMENZI table columns"""
print("🔍 Checking COMENZI table structure...")
try:
with oracledb.connect(user=user, password=password, dsn=dsn) as conn:
with conn.cursor() as cur:
# Get table structure
cur.execute("""
SELECT
column_name,
data_type,
nullable,
data_length,
data_precision
FROM user_tab_columns
WHERE table_name = 'COMENZI'
ORDER BY column_id
""")
columns = cur.fetchall()
if columns:
print(f"\nCOMENZI table columns:")
for col in columns:
nullable = "NULL" if col[2] == 'Y' else "NOT NULL"
if col[1] == 'NUMBER' and col[4]:
type_info = f"{col[1]}({col[4]})"
elif col[3]:
type_info = f"{col[1]}({col[3]})"
else:
type_info = col[1]
print(f" {col[0]}: {type_info} - {nullable}")
# Look for partner-related columns
print(f"\nPartner-related columns:")
for col in columns:
if 'PART' in col[0] or 'CLIENT' in col[0]:
print(f" {col[0]}: {col[1]}")
except Exception as e:
print(f"❌ Check failed: {e}")
def main():
print("🔍 COMENZI Table Structure")
print("=" * 40)
check_table_structure()
if __name__ == "__main__":
main()