Welcome to our Python SDK!This powerful library allows you to seamlessly connect and query your databases using the simplicity and flexibility of Python.
With comprehensive documentation and intuitive APIs, you can efficiently manage and manipulate data, unlocking new possibilities for your projects.
First, set up your API_TOKEN and ENGINE_URL (recommended). You can find them by accessing your workspace’s settings page.
Head over to the Developer tab, and then copy your API Token and Engine URL.
Import the ThanoSQL client and use it to query your ThanoSQL Workspace.
Copy
from thanosql import ThanoSQLclient = ThanoSQL()# defaults to getting the token using os.environ.get("THANOSQL_API_TOKEN"),# and also defaults to getting the url using os.environ.get("THANOSQL_ENGINE_URL"),# client = ThanoSQL(# api_token='your-api-token-here',# engine_url='your-engine-url-here'# )res = client.query.execute(query="SELECT 1")print(res.model_dump_json(indent=4))tables = client.table.list(schema="public")# do something with the list of tablesfor table in tables: print(table.name)
Assistant
Responses are generated using AI and may contain mistakes.