gcp spark quickstart 2 - fraud detector
Let's create another python script that we can run with our serverless spark cluster. Some preliminary setup here :- gcloud services enable dataproc.googleapis.com bigquery.googleapis.com export BUCKET = $ (gcloud config get - value project) - fraud - demo gcloud storage buckets create gs : // $ BUCKET -- location = us - central1 bq mk -- location = US fraud And next we will create the requires tables in bigquery - all these command are ran from the command line bq query -- use_legacy_sql = false << 'SQL' CREATE OR REPLACE TABLE fraud.transactions AS WITH normal AS ( SELECT GENERATE_UUID() AS txn_id, CONCAT( 'card_' , CAST( 1 + CAST(FLOOR(RAND() * 5000 ) AS INT64 ) AS STRING )) AS card_id, ROUND( 5 + 100 * POW(RAND(), 3 ), 2 ) AS amount, TIMESTAMP_ADD(TIMESTAMP( '2026-11-01' ), INTERVAL CAST(FLOOR(RAND() * 30 * 24 * 3600 ) AS ...