orcalib.table#
TableHandle
#
A handle to a table in the Orca database
Parameters:
get_column_type_dict
#
Get a dictionary of column names and orca types for this table
Returns:
-
dict[ColumnName, OrcaTypeHandle]
–A dictionary of column names and orca types
Examples:
copy
#
__getattr__
#
Get a column handle by name
Parameters:
-
column_name
(str | ColumnHandle
) –The name of the column
Returns:
-
ColumnHandle
–A column handle
__getitem__
#
Get a column handle by name
Parameters:
-
column_name
(str | ColumnHandle
) –The name of the column
Returns:
-
ColumnHandle
–A column handle
get_column
#
Get a column handle by name
Parameters:
-
column_name
(str | ColumnHandle
) –The name of the column
Returns:
-
ColumnHandle
–A column handle
select
#
Start a new query on this table
Parameters:
-
*args
(str | ColumnHandle
, default:()
) –The columns to select
Returns:
-
TableQuery
–The chainable query object
Examples:
where
#
Start a new query on this table
Parameters:
-
*args
(OrcaExpr
, default:()
) –Query filter
Returns:
-
TableQuery
–The chainable query object
order_by
#
Start a new query on this table
Parameters:
-
*args
(str | ColumnHandle
, default:()
) –The columns to order by
-
**kwargs
(Order | Literal['ASC', 'DESC']
, default:{}
) –Order direction
Returns:
-
TableQuery
–The chainable query object
fetch
#
df
#
insert
#
Insert rows into the table
Note
Positional and keyword arguments cannot be mixed.
Parameters:
-
*args
(RowData
, default:()
) –The row data to insert. This can be a RowDict, a pandas DataFrame, or a list of RowDicts.
-
**kwargs
(Any
, default:{}
) –Specifies the keys and values to insert. This can be used to insert a single row.
Examples:
Insert a single row as a dict:
Insert multiple rows as multiple arguments:
Insert multiple rows as a list of dicts:
Insert multiple rows as a pandas DataFrame:
Insert a single row as keyword arguments:
update
#
upsert
#
Upsert rows into the table
Parameters:
-
data
(RowData
) –The row data to insert.
-
key_columns
(list[ColumnName]
) –The columns to use as the primary key
Examples:
delete
#
Delete rows from the table
Parameters:
-
filter
(OrcaExpr
) –The filter to apply to the rows to delete
Examples:
count
#
add_column
#
Add columns to the table
Parameters:
-
**columns
(OrcaTypeHandle
, default:{}
) –The columns to add
Examples: