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 isTrue
and a file exists insave_path
location, this method will ovewrite the existing file. If this parameter isFalse
and a file exists insave_path
location, this method will skip the download. Default toFalse
- scope: str (optional)
The splus.cloud scope. Can be
public
orprivate
. Useprivate
only if you are assigned as collaborator. Defaults topublic
- 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')