IO Config Setup
Learn how to set up and configure the io_config file for your Mage project
IO Config Setup Guide
The io_config
file is a crucial configuration file in Mage that stores credentials and connection information for accessing various data sources. This guide will help you understand where to store it and how to create it from scratch.
File Location
The io_config
file should be stored in your Mage project’s root directory. The default path is:
Creating a New io_config File
1. Basic Structure
Create a new file named io_config.yaml
in your project’s default_repo
directory with the following basic structure:
2. Configuration Formats
Mage supports two formats for the io_config
file:
Standard Format (Recommended)
Legacy Format (Verbose)
3. Using Environment Variables
For security, it’s recommended to use environment variables for sensitive information:
4. Multiple Profiles
You can create multiple profiles for different environments or use cases:
Using io_config in Your Code
Python Block Example
SQL Block Example
In SQL blocks, you can select the desired IO Config profile from the UI using the “Profile” dropdown menu.
Best Practices
-
Security:
- Never commit sensitive credentials directly in the
io_config
file - Use environment variables for sensitive information
- Consider using a secrets management service for production environments
- Never commit sensitive credentials directly in the
-
Organization:
- Use meaningful profile names
- Group related configurations together
- Document any non-standard configurations
- Use the standard format for new configurations
-
Version Control:
- Add
io_config.yaml
to your.gitignore
file - Provide a template file (
io_config.yaml.template
) with dummy values - Document the required environment variables
- Add
Troubleshooting
If you encounter issues with your io_config
:
- Verify the file is in the correct location (
default_repo/io_config.yaml
) - Check that all required fields are present
- Ensure environment variables are properly set
- Validate the YAML syntax
- Check the connection credentials
- Verify you’re using the correct configuration format (standard or verbose)