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

jyablonski / python_docker / 14425268639

13 Apr 2025 02:37AM UTC coverage: 86.047%. First build
14425268639

Pull #94

github

web-flow
Merge a00372664 into 265e9c2b5
Pull Request #94: Ingestion v2.0.0

469 of 558 new or added lines in 12 files covered. (84.05%)

851 of 989 relevant lines covered (86.05%)

0.86 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
    """
8
    Simple Wrapper Function to write a Pandas DataFrame to SQL
9

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

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

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

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

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

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

38
        return None
1✔
NEW
39
    except Exception as error:
×
NEW
40
        logging.error(f"SQL Write Script Failed, {error}")
×
NEW
41
        return None
×
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