Basic API#
To begin your querying session, get a connection with a cursor to EvaDB using connect
and cursor
function calls:
|
Connects to the EvaDB server and returns a connection object. |
|
Retrieves a cursor associated with the connection. |
import evadb
cursor = evadb.connect().cursor()
After getting a cursor, you can load documents and run queries using the EvaDBCursor
interface. To construct the queries with pandas-like API,
use the EvaDBQuery
interface.
### load the pdfs in a given folder into the "office_data" table
cursor.load(
file_regex=f"office_data/*.pdf", format="PDF", table_name="office_data_table"
).df()
### load a given video into the "youtube_videos" table
cursor.load("movie.mp4", "youtube_videos", "video").df()
Warning
It is important to call df
to run the actual query and get the result dataframe. EvaDB does lazy query execution to improve performance.
Calling cursor.query("...")
will only construct and not run the query. Calling cursor.query("...").df()
will both construct and run the query.
EvaDBCursor Interface#
Using the cursor, you can refer to a table, load documents, create functions, create vector index, and several other tasks.
After connecting to a table using table
, you can construct a complex query using the EvaDBQuery
interface.
|
Retrieves data from a table in the database. |
|
Loads data from files into a table. |
|
Executes a SQL query. |
|
Create a udf in the database. |
|
Create a udf in the database. |
|
Creates a vector index using the provided expr on the table. |
|
Drop a table in the database. |
|
Drop a udf in the database. |
|
Drop an index in the database. |
|
Returns the result as a pandas DataFrame. |
|
Shows all entries of the current object_type. |
|
Executes an INSERT query. |
|
Executes an EXPLAIN query. |
|
Executes a RENAME query. |
EvaDBQuery Interface#
|
Projects a set of expressions and returns a new EvaDBQuery. |
|
Execute a expr on all the rows of the relation |
|
Filters rows using the given condition. |
|
Execute and fetch all rows as a pandas DataFrame |
|
Returns a new Relation with an alias set. |
|
Limits the result count to the number specified. |
|
Reorder the relation based on the order_expr |
|
Execute and fetch all rows as a pandas DataFrame |
Get the SQL query that is equivalent to the relation |
|
|
Transform the relation into a result set |