Get startedGet started for free

Querying a column-oriented database

In this example, you'll use Snowflake to query data from the olympic_medals table. This table contains information about Olympic medal winners going back to 1896. To work with this data stored in Snowflake, you'll be using the snowflake.connector package. A connection object has been created, which is stored in the variable conn. Best of luck!

This exercise is part of the course

Introduction to NoSQL

View Course

Exercise instructions

  • Update the string stored to the query variable to return all columns of the olympic_medals table, limiting to the first ten rows.
  • Execute the query stored in the query variable, using the conn.cursor().execute() function.
  • Print the results of the query, which are stored in the results variable.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Write a query to return all columns, limiting to 10 rows
query = "SELECT * FROM ____ LIMIT 10;"

# Execute the query
results = conn.cursor().execute(____).fetch_pandas_all()

# Print the results of the query
print(____)
Edit and Run Code