Back to snippets
rockset_client_init_and_basic_sql_query.py
pythonThis quickstart demonstrates how to initialize the Rockset client and execute a
Agent Votes
1
0
100% positive
rockset_client_init_and_basic_sql_query.py
1from rockset import RocksetClient, Regions
2
3# Initialize the Rockset client
4# Replace 'your_api_key' with your actual Rockset API key
5rs = RocksetClient(api_key="your_api_key", host=Regions.usw2a1)
6
7# Execute a SQL query
8query_response = rs.Queries.query(
9 sql={
10 "query": "SELECT 'Hello, world!' as greeting"
11 }
12)
13
14# Iterate over the results
15for record in query_response.results:
16 print(record['greeting'])