Next steps¶
This section provides some next steps for you to continue learning about PySQLXEngine.
PySQLXEngine has some methods; among them, the query
and execute
methods are handy.
The methods .query*
is used to execute a query that returns data, and .execute
is used to run a query that does not return data but only the number of rows affected.
Both methods have the two parameters:
sql
: The SQL query to be executed.parameters
: The parameters to be passed to the query. This parameter is optional.
Note
SQL must be a str with or without named parameters.
Note
Parameters must be a dictionary with the named parameters and their values.
Example of use¶
For this example, we will use the sqlite
database. Create a main.py
file and add the code examples below.
Create a table¶
Running the code using the terminal
Insert data¶
Running the code using the terminal
Select data¶
Running the code using the terminal
Update data¶
Running the code using the terminal
Delete data¶
main.py | |
---|---|
Running the code using the terminal
Drop table¶
Running the code using the terminal