test_check_data_products.py 794 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env python3
  2. """检查数据产品表记录"""
  3. from app import create_app, db
  4. from sqlalchemy import text
  5. app = create_app()
  6. with app.app_context():
  7. # 查询最新的数据产品记录
  8. result = db.session.execute(text('''
  9. SELECT id, product_name, product_name_en, target_table, source_dataflow_name, created_at
  10. FROM data_products
  11. ORDER BY created_at DESC
  12. LIMIT 5
  13. ''')).fetchall()
  14. print('最新的数据产品记录:')
  15. print('-' * 100)
  16. for row in result:
  17. print(f'ID: {row[0]}')
  18. print(f' 产品名: {row[1]}')
  19. print(f' 英文名: {row[2]}')
  20. print(f' 目标表: {row[3]}')
  21. print(f' 来源数据流: {row[4]}')
  22. print(f' 创建时间: {row[5]}')
  23. print('-' * 100)