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!
Diese Übung ist Teil des Kurses
Introduction to NoSQL
Anleitung zur Übung
- Update the string stored to the
queryvariable to return all columns of theolympic_medalstable, limiting to the first ten rows. - Execute the query stored in the
queryvariable, using theconn.cursor().execute()function. - Print the results of the query, which are stored in the
resultsvariable.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# 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(____)