Skip to content

execute(statement: str)

Marcel Ferrari edited this page Feb 9, 2023 · 1 revision

The execute function is used to execute a query that has no return data. It takes a single argument, the statement string, and returns None.

Function

def execute(statement: str) -> None:
    """
    Execute query that has no return data.

    Parameters:
    - statement (str): SQL statement to be executed

    Returns:
    None
    """

Example

# Connect to the database
db = PandaSQLiteDB("example.sql")

# Execute a statement to create a table named "my_table"
db.execute("CREATE TABLE my_table (id INTEGER PRIMARY KEY, name TEXT, value REAL)")