Build a no-code ML workflow with Snowflake, Amazon SageMaker Canvas and Amazon Quick – Part 2: Data preparation and model building with Amazon SageMaker Canvas Amazon Web Services (AWS) published Part 2 of its no-code machine learning workflow series, detailing how to use Amazon SageMaker Canvas to connect to Snowflake, prepare data with Data Wrangler, and build a fraud detection model using the XGBoost algorithm. The post walks through creating an Amazon SageMaker domain, launching Canvas, and importing tabular data, with prerequisites from Part 1 covering Snowflake setup. Artificial Intelligence /blogs/machine-learning/ Build a no-code ML workflow with Snowflake, Amazon SageMaker Canvas and Amazon Quick – Part 2: Data preparation and model building with Amazon SageMaker Canvas Part 1 /blogs/machine-learning/build-a-no-code-ml-workflow-with-snowflake-amazon-sagemaker-canvas-and-amazon-quick-part-1-setting-up-your-snowflake-environment/ covered the Snowflake database setup and established the foundational infrastructure for this no-code machine learning ML workflow. Part 2 of this blog series covers complete data preparation and model building workflow using Amazon SageMaker Canvas, demonstrating how to connect directly to Snowflake data sources, transform and prepare data using Data Wrangler’s visual transformations, and build a fraud detection model using the XGBoost algorithm. Amazon SageMaker Canvas /sagemaker/ai/canvas/ is a visual, no-code machine learning service that enables business analysts and domain experts to build accurate ML models and generate predictions. Amazon SageMaker Canvas provides an intuitive interface for data preparation, model training, and prediction generation democratizing access to machine learning across organizations while maintaining enterprise security and governance. Solution overview This solution guides you through the complete workflow of preparing data and building a machine learning model using Amazon SageMaker Canvas, with direct integration to your Snowflake data warehouse. Prerequisites Complete Part 1 /blogs/machine-learning/build-a-no-code-ml-workflow-with-snowflake-amazon-sagemaker-canvas-and-amazon-quick-part-1-setting-up-your-snowflake-environment/ setting up your Snowflake environment before starting this post. You need the Snowflake account credentials and connection details from Part 1 to complete the steps in this post. Amazon SageMaker Canvas setup Open the AWS Management Console and search for Amazon SageMaker Canvas. Select it from the list, or press Enter. Create your Amazon SageMaker domain A domain provides the foundational organizational unit for your Amazon SageMaker environment. It serves as a dedicated workspace that houses user profiles, storage configurations, and security settings. Each domain delivers isolated resources and access controls for managing team collaboration and data governance. - Navigate to environment configurations in the left pane and choose Domains . - Choose Create domain . - Choose Set up for single user Quick setup https://docs.aws.amazon.com/sagemaker/latest/dg/onboard-quick-start.html to automatically create both your domain and user profile. Launch Amazon SageMaker Canvas - Select Canvas from the left-hand pane. - Choose the domain and user profile you created. - Choose Open Canvas . - Wait 3–5 minutes while Canvas prepares your workspace. Data Wrangler: ML data preparation Amazon SageMaker Data Wrangler /sagemaker/ai/data-wrangler/ simplifies data preparation for machine learning workflows. With built-in transformations and an intuitive visual interface, Data Wrangler reduces the time traditionally spent on data preparation and analysis. For industries ranging from financial services to healthcare, this capability unlocks significant value so subject matter experts can directly prepare their data for analysis. The integration with Snowflake reduces data movement challenges, so users can connect directly to their Snowflake data warehouses, transform the data within Canvas, and proceed straight to model building. This unified, no-code environment accelerates time-to-insight while maintaining data governance and security. A. Data connection and initial setup In this section, you connect Amazon SageMaker Canvas to a Snowflake data source. - Navigate to Amazon SageMaker Canvas and choose Data Wrangler from the left navigation pane. Choose Import and prepare , then choose Tabular to work with structured datasets. - Specify the source of your tabular dataset. From the data source menu , choose Snowflake as your connection type. Then choose Add Connection to establish the link between Amazon SageMaker Canvas and your Snowflake environment. With this integration, you can access your cloud data warehouse directly within Canvas. It avoids manual data exports and makes sure you are always working with the most current data in your Snowflake instance. - In the Snowflake connection pop-up menu, provide the following: - A connection name. - The Account ID , set to your Snowflake organization value, plus a hyphen, plus the Snowflake account ID. - The username for the Snowflake account you set up earlier. - The password that you set previously. - After the connection is established, you will create card-level outlier thresholds to identify unusual spending patterns for each credit card and category combination. This helps the model detect when a transaction amount significantly deviates from a cardholder’s typical behavior. Copy the SQL query to prepare the fraud detection dataset. - Run the query: - Choose Edit in SQL in the top right corner to open the SQL editor. - Paste the SQL query into the editor. - Choose Run SQL to run and preview results. - Choose Import to bring the dataset into your Canvas workspace. - Choose B. Data enrichment In the following steps, you will enrich the dataset with transaction-level features and merchant-specific fraud indicators. - Choose Data flow to add more data. In the top right corner, choose Add Data , and then choose Tabular . - Choose the data source as Snowflake and the existing connection you created before. - In the Edit SQL window, paste the SQL query. This query provides temporal patterns hour of day, day of week , demographic information age categories , and merchant-level outlier thresholds, all critical signals for fraud detection. Choose Run SQL , then choose Import . C. Data transformation In this section, you will join the data together. - On the Data flow screen, you see the two data sources imported from Snowflake. Choose the first data type and choose the plus icon next to it. Choose Combine data , then Join . When the right panel opens, choose the second data type from the data flow to join. - Choose Left outer join for the Join type . Add a Join key and choose Category as the left and right join key. - Choose Preview to view the joined data. Choose Add to proceed. Next, you will create outlier features and remove sensitive columns. - Return to the Data flow screen, choose the join, choose the plus sign + next to it, and then choose Add transform . - After the interface opens, choose Add transform in the right-hand panel, and then choose Custom Formula . - This option gives you the flexibility to add columns using a Spark SQL expression. Copy and paste the following Formula on the Home tab. Enter the output column as CC FLAG and choose Add . - To add another column, repeat the same steps to enter a custom formula, then copy and paste this query and name the output column as MERCHANT AMT FLAG . - To make sure the model remains free of sensitive information such as card numbers, merchant names, and outlier amounts tied to cards or merchants, remove these columns using built-in transformation. - Select Add transform and choose Manage Columns - Select the Transform type to Drop column - Select the columns you want to remove from your dataset - Choose Add to apply the transformation. CC NUM . AMT OUTLIER . MERCHANT . MERCHANT AMT OUTLIER . - Select D. Quality analysis and model export With data preparation complete, you will run a quality analysis report https://docs.aws.amazon.com/sagemaker/latest/dg/data-wrangler-data-insights.html to get insights into the data. The insights report identifies common data issues, such as target leakage or class imbalance, helping users address them early in the workflow. - To initiate the analysis, choose the Analyses tab. In the right-hand panel, choose Data Quality and Insights Report from the Analysis type list. - Choose IS FRAUD as the target column . This tells Canvas which variable you want to predict. Then choose the Classification option under Problem type . The Data size should remain as Sampled Dataset . Finally, choose Create to launch the analysis. - Within a few minutes, a detailed analysis report will be created which includes a quick summary of the data, feature summary, duplicate rows, anomalous samples and much more. In the Quick model section, review the accuracy metrics in the training and validation datasets. A confusion matrix follows the accuracy statistics. The idea is to use this report after any data engineering to observe how it impacts model quality. - The feature summary section shows feature importance. In practice, if there are features with low prediction power, you might choose to drop those features. Export to model building You’ve now combined two data sources, engineered new features, removed unnecessary ones, and previewed your model’s potential accuracy by running the analysis. With data preparation complete, it’s time to build your predictive model. - To begin, return to the Data flow tab, choose the plus sign + next to your final transform, and then choose Create model . - Choose a descriptive name under Model name , and then choose Export and create model . The export process may take a few minutes as Canvas processes your entire dataset in real time. After a few minutes, the Build screen opens up. - Choose IS FRAUD as the Target Column . - Choose Configure model under Model type. Select 2-category model as model type . - Next, select Ensemble as the training method with XGBoost as the algorithm, a strategic choice that balances accuracy with efficiency. - Deselect the FRAUD HISTORY and MERCHANT FRAUD HISTORY columns, then choose Standard build to start training. The model takes approximately 15–30 minutes to complete. - With the model training complete, navigate to the Analyze tab to review the results. Here, you can examine which features had the most impact on predictions and explore the scatterplot and charts to understand relationships between data values and fraud classification. - Choose Advanced Metrics to further understand model performance. - Next, use the trained model to make predictions on an unseen dataset. Download the sample prediction CSV file. https://aws-blogs-artifacts-public.s3.us-east-1.amazonaws.com/artifacts/ML-20655/prediction dataset.csv Navigate to the Predict tab. Choose Manual , and then choose Create Dataset . - Upload the dataset, choose Preview dataset , and then choose Create dataset . After the dataset loads, choose the dataset and choose Generate Predictions . The model takes a few minutes to make the predictions. Wait until the status of the job changes to Ready . - To analyze the results visually using Amazon Quick Sight /quick/quicksight/ , you must first verify the following prerequisites detailed here https://docs.aws.amazon.com/sagemaker/latest/dg/canvas-send-predictions.html :- Verify AWS Region alignment: Your Quick Sight account must be set up in the same AWS Region as your Amazon SageMaker Canvas domain. - Add Amazon Quick Sight permissions to your Amazon SageMaker execution role: The AWS Identity and Access Management IAM execution role attached to your Amazon SageMaker domain needs additional permissions to send predictions to Amazon Quick Sight. Navigate to the IAM console, find the execution role associated with your Amazon SageMaker domain created during setting up Amazon SageMaker domain https://docs.aws.amazon.com/sagemaker/latest/dg/onboard-quick-start.html at the very beginning , and add the required inline policy as described here https://docs.aws.amazon.com/sagemaker/latest/dg/canvas-quicksight-permissions.html . - Grant Quick Sight access to the Amazon SageMaker S3 bucket: Navigate to Quick Sight, go to Manage Accounts , then choose AWS Resources from the left-hand navigation pane. Make sure Amazon Simple Storage Service Amazon S3 is selected and choose the appropriate S3 bucket that has the predictions generated by Amazon SageMaker Canvas, named sagemaker-{region}-{account id}. - Add Quick Sight users: Make sure the users you want to share predictions with have been added to your Quick Sight account with an Author or Admin role. Go to Manage Quick Sight and navigate to Manage users to invite new users or verify existing ones. For details, see Managing user access https://docs.aws.amazon.com/quick/latest/userguide/managing-user-access-qs-iam.html . You will enter their usernames when sending predictions. - Next, select the Job name and choose Send to Amazon Quick Sight . - In the new window, add the users who were previously granted Amazon Quick Sight permissions as viewers of the dashboard, and then choose Send . Conclusion Part 2 covered the complete data preparation and model building workflow in Amazon SageMaker Canvas from connecting to Snowflake data sources and engineering features using Data Wrangler’s visual transformations, to joining multiple data sources, analyzing data quality, and training a fraud detection model all without requiring machine learning programming expertise. With the trained model now generating predictions on unseen data, the foundation is set for Part 3 /blogs/machine-learning/build-a-no-code-ml-workflow-with-snowflake-amazon-sagemaker-canvas-and-amazon-quick-part-3-visualizing-insights-with-amazon-quick-sight/ , where those ML-driven insights are brought to life through interactive dashboards in Amazon Quick Sight. References - Part 1 – Build a no-code ML workflow with Snowflake, Amazon SageMaker Canvas and Amazon Quick – Part 1: Setting up your Snowflake environment /blogs/machine-learning/build-a-no-code-ml-workflow-with-snowflake-amazon-sagemaker-canvas-and-amazon-quick-part-1-setting-up-your-snowflake-environment/ - Part 3 – Build a no-code ML workflow with Snowflake, Amazon SageMaker Canvas and Amazon Quick – Part 3: Visualizing insights with Amazon Quick Sight /blogs/machine-learning/build-a-no-code-ml-workflow-with-snowflake-amazon-sagemaker-canvas-and-amazon-quick-part-3-visualizing-insights-with-amazon-quick-sight/