vastorbit.core.tablesample.base.TableSample.read_sql¶
- classmethod TableSample.read_sql(query: str | StringSQL, title: str | None = None, max_columns: int = -1, _clean_query: bool = True, _formats: list[str] | None = None) TableSample¶
Returns the result of a SQL query as a
TableSampleobject.- Parameters:
query (str, optional) – SQL Query.
title (str, optional) – Query title when the query is displayed.
max_columns (int, optional) – Maximum number of columns to display.
- Returns:
Result of the query.
- Return type:
Examples
Let’s import the
TableSampleobject:from vastorbit import TableSample
Let’s build an example object.
# SQL query. sql = "SELECT 30 AS age, 'Vanesa' AS name, 'Sofia' AS city;" # creating the object from the SQL query. tb = TableSample.read_sql( query = sql, title = 'Building a TableSample for testing', max_columns = 2, # Maximum number of columns to display. )
123ageInteger... AbccityVarchar(5)1 30 ... Sofia Rows: 1-1 | Columns: 3See also
VastFrame: Main vastorbit dataset object.