updating psql to prevent injection

main
Matthew Huntington 2 years ago
parent b6450d2009
commit 1059187843

@ -11,7 +11,7 @@
## Install a Python virtual environment ## Install a Python virtual environment
``` ```python
python3 -m venv ~/my-env python3 -m venv ~/my-env
source ~/my-env/bin/activate source ~/my-env/bin/activate
``` ```
@ -50,8 +50,8 @@ cursor.close()
Select one Select one
```ptyon ```python
cursor.execute("SELECT * FROM people WHERE id = 12") cursor.execute("SELECT * FROM people WHERE id = %s", [24])
print(cursor.fetchone()) print(cursor.fetchone())
``` ```
@ -65,7 +65,7 @@ conn.commit()
Delete Delete
```python ```python
cursor.execute("DELETE FROM people WHERE id = 12"); cursor.execute("DELETE FROM people WHERE id = %s", [24]);
conn.commit() conn.commit()
``` ```
@ -75,3 +75,9 @@ Update
cursor.execute("UPDATE people SET name = %s, age = %s WHERE id = %s", ['Matt', 43, 20]) cursor.execute("UPDATE people SET name = %s, age = %s WHERE id = %s", ['Matt', 43, 20])
conn.commit() conn.commit()
``` ```
## Migrating data to a SQLite
## Exporting data to CSV

Loading…
Cancel
Save