Python Database Scraper Automation

Job ID: 40310168

Budget: $250 – $750 USD

I need a compact, well-documented Python script that can connect to a remote database, authenticate whenever required, and pull all of the structured table data I specify. Part of the data is publicly exposed, while the rest sits behind simple login credentials, so the code must handle both paths seamlessly in one run.

Here’s what matters to me:

• Connection & auth: use a mainstream driver (e.g., psycopg2, mysql-connector-python, or SQLAlchemy) so I can adapt it later. Include a small config section where I can drop host, port, user, and password values and switch between “public” and “auth” queries.

• Data extraction: run the provided list of SELECT statements (I’ll add them after hand-off), fetch the complete result sets, and write each to its own CSV. A clean Pandas DataFrame pipeline is fine as long as the raw rows remain intact.

• Re-run safe: if a CSV already exists, the script should either append only new rows or overwrite it based on a simple flag I set at the top.

• Lightweight logging: print progress to console and save a .log file with timestamps, executed query text, and row counts.

Acceptance criteria
– One cross-platform Python 3 script, <300 lines, PEP-8 compliant
– A README outlining setup, required pip installs, and how to pass in credentials
– Sample output files generated from a small test query so I can verify format

If you’ve built similar scrapers or ETL utilities, let me know what stack you used and how quickly you can turn this around.