def fetch_bigquery_data()

in tooling/enrichment/main.py [0:0]


def fetch_bigquery_data(last_processed_id):
    client = bigquery.Client(project=PROJECT_ID)
    
    query = f"""
    SELECT *
    FROM `{PROJECT_ID}.{DATASET}.{TABLE}`
    WHERE id > {last_processed_id}
    ORDER BY id
    LIMIT {BATCH_SIZE}
    """
    
    try:
        df = client.query(query).to_dataframe()
        print(f"\nProcessing {len(df)} rows starting from ID: {last_processed_id}")
        return df
    except Exception as e:
        print(f"Error occurred: {str(e)}")
        return None