astromodule.splus.SplusService.query#

SplusService.query(sql: str, save_path: str | Path, replace: bool = False, scope: Literal['public', 'private'] = 'public', table=None, fmt: str = 'text/csv')[source]#

Sends a single query to splus.cloud database

Parameters:
sql: str

The sql query string

save_path: str or Path

The path where the query output will be saved

repalace: bool (optional)

This method checks if a file exists in save_path location before the download. If this parameters is True and a file exists in save_path location, this method will ovewrite the existing file. If this parameter is False and a file exists in save_path location, this method will skip the download. Default to False

scope: str (optional)

The splus.cloud scope. Can be public or private. Use private only if you are assigned as collaborator. Defaults to public

fmt: str (optional)

The mimi-type of query output. Defaults to text/csv

Examples

>>> service.query('SELECT TOP 10 * FROM dr1.all_dr1', 'query.csv')