0
0
GCPcloud~15 mins

Cloud SQL supported engines (MySQL, PostgreSQL, SQL Server) in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Cloud SQL supported engines (MySQL, PostgreSQL, SQL Server)
📖 Scenario: You are setting up a Cloud SQL instance on Google Cloud Platform. Cloud SQL supports three main database engines: MySQL, PostgreSQL, and SQL Server. You want to create a configuration dictionary that lists these supported engines and their default versions.
🎯 Goal: Create a Python dictionary that holds the supported Cloud SQL engines as keys and their default versions as values. Then, add a configuration variable to select the default engine. Next, write code to extract the version of the selected engine. Finally, complete the configuration by adding a key for the region where the Cloud SQL instance will be deployed.
📋 What You'll Learn
Create a dictionary called cloud_sql_engines with keys 'MySQL', 'PostgreSQL', and 'SQL Server' and their default versions as values.
Create a variable called default_engine and set it to 'PostgreSQL'.
Write code to get the version of the default_engine from cloud_sql_engines and store it in selected_version.
Add a key 'region' with value 'us-central1' to the cloud_sql_engines dictionary.
💡 Why This Matters
🌍 Real World
Cloud SQL is a managed database service on Google Cloud Platform that supports popular database engines. Knowing how to configure supported engines and their versions is essential when setting up databases for applications.
💼 Career
Cloud engineers and developers often need to configure and manage Cloud SQL instances. Understanding how to represent and manipulate configuration data programmatically helps automate deployments and maintain infrastructure.
Progress0 / 4 steps
1
Create the Cloud SQL engines dictionary
Create a dictionary called cloud_sql_engines with these exact entries: 'MySQL': '8.0', 'PostgreSQL': '14', and 'SQL Server': '2019'.
GCP
Need a hint?

Use curly braces {} to create a dictionary with the given keys and values.

2
Set the default engine
Create a variable called default_engine and set it to the string 'PostgreSQL'.
GCP
Need a hint?

Assign the string 'PostgreSQL' to the variable default_engine.

3
Get the version of the selected engine
Write code to get the version of the engine stored in default_engine from the cloud_sql_engines dictionary and assign it to a variable called selected_version.
GCP
Need a hint?

Use the default_engine variable as the key to get the version from cloud_sql_engines.

4
Add the region to the configuration
Add a new key 'region' with the value 'us-central1' to the cloud_sql_engines dictionary.
GCP
Need a hint?

Use square brackets to add a new key-value pair to the dictionary.