Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 9, 2026

Database snapshots (database.sql.gz, database2.sql.gz) were being overwritten each run instead of accumulating historical auction data.

Root Cause

__main__.py creates fresh databases on each run. After prepare_db_snapshots.py removes the .db files, subsequent runs had no restoration step, causing data loss.

Changes

  • Added restore_database_from_gzip() to __main__.py:
    • Decompresses .sql.gz files using gzip.open()
    • Restores databases via sqlite3.executescript() with context manager
    • Called before any database operations in main()
def restore_database_from_gzip(db_name):
    """Restore a database from its .sql.gz file if it exists and the .db doesn't."""
    db_path = Path(db_name)
    gz_path = db_path.with_suffix('.sql.gz')
    
    if gz_path.exists() and not db_path.exists():
        with gzip.open(gz_path, 'rt') as gz_file:
            sql_script = gz_file.read()
        with sqlite3.connect(str(db_path)) as conn:
            conn.executescript(sql_script)
        return True
    # ...

Now each workflow run restores existing data, appends new auctions, then prepare_db_snapshots.py creates updated gzip snapshots containing full history.

Original prompt

Both gzips appear to only store data for the refresh they got actions in and are not stacking and logging at all. Please fix this


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits January 9, 2026 00:17
Co-authored-by: UltimateBoi <63293118+UltimateBoi@users.noreply.github.com>
Co-authored-by: UltimateBoi <63293118+UltimateBoi@users.noreply.github.com>
Co-authored-by: UltimateBoi <63293118+UltimateBoi@users.noreply.github.com>
Co-authored-by: UltimateBoi <63293118+UltimateBoi@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix gzip data logging for actions Fix database accumulation in gzip snapshots across workflow runs Jan 9, 2026
Copilot AI requested a review from UltimateBoi January 9, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants