• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jyablonski / python_docker / 16377912806

18 Jul 2025 06:38PM UTC coverage: 83.993% (+2.1%) from 81.898%
16377912806

Pull #103

github

web-flow
Merge 6a9e6d86f into b776ef9e6
Pull Request #103: Ingestion v2.0.8

15 of 29 new or added lines in 5 files covered. (51.72%)

1 existing line in 1 file now uncovered.

467 of 556 relevant lines covered (83.99%)

0.84 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/database.py
1
import logging
1✔
2

3
import pandas as pd
1✔
4

5

6
def write_to_sql(con, table_name: str, df: pd.DataFrame, table_type: str) -> None:
1✔
7
    """Simple Wrapper Function to write a Pandas DataFrame to SQL
8

9
    Args:
10
        con (SQL Connection): The connection to the SQL DB.
11

12
        table_name (str): The Table name to write to SQL as.
13

14
        df (DataFrame): The Pandas DataFrame to store in SQL
15

16
        table_type (str): Whether the table should replace or append to an
17
            existing SQL Table under that name
18

19
    Returns:
20
        Writes the Pandas DataFrame to a Table in the Schema we connected to.
21

22
    """
23
    try:
1✔
24
        if len(df) == 0:
1✔
25
            logging.info(f"{table_name} is empty, not writing to SQL")
×
26
        else:
27
            df.to_sql(
1✔
28
                con=con,
29
                name=table_name,
30
                index=False,
31
                if_exists=table_type,
32
            )
33
            logging.info(
1✔
34
                f"Writing {len(df)} {table_name} rows to aws_{table_name}_source to SQL"
35
            )
36

37
        return
1✔
38
    except Exception as error:
×
39
        logging.error(f"SQL Write Script Failed, {error}")
×
NEW
40
        return
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc