import re

tables = {}
with open('xygameco_xygaming.sql', 'r', encoding='utf-8', errors='ignore') as f:
    for line in f:
        if line.startswith('INSERT INTO'):
            m_insert = re.match(r'INSERT INTO [`"]?([a-zA-Z0-9_]+)[`"]?', line)
            if m_insert:
                t = m_insert.group(1)
                cnt = line.count('),(') + 1 if '),(' in line else (1 if ');' in line else 0)
                tables[t] = tables.get(t, 0) + cnt

print('=== MARIADB SQL DUMP RECORD COUNTS ===')
for t, count in sorted(tables.items(), key=lambda x: x[1], reverse=True):
    print(f'{t}: {count} records')
