Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentes Révision précédente Prochaine révision | Révision précédente | ||
python:sqlite3:start [2021/10/02 05:19] marclebrun [SQLite 3] |
python:sqlite3:start [2024/01/21 15:09] (Version actuelle) marclebrun |
||
---|---|---|---|
Ligne 4: | Ligne 4: | ||
* SQLite [[https://www.sqlite.org/docs.html]] | * SQLite [[https://www.sqlite.org/docs.html]] | ||
* Librairie Python : [[https://docs.python.org/2/library/sqlite3.html]] | * Librairie Python : [[https://docs.python.org/2/library/sqlite3.html]] | ||
+ | * [[https://www.sqlite.org/datatype3.html|Datatypes In SQLite]] | ||
===== Installation ===== | ===== Installation ===== | ||
Ligne 36: | Ligne 37: | ||
''') | ''') | ||
</code> | </code> | ||
+ | |||
+ | ===== Version et migration de la DB ===== | ||
+ | |||
+ | Utilisation de **PRAGMA user_version** pour mettre à jour la structure | ||
+ | d'une base de données dès la connexion : | ||
+ | * [[https://groups.google.com/g/python-sqlite/c/brlzyZeySns]] | ||
+ | |||
===== Requêtes paramétrées ===== | ===== Requêtes paramétrées ===== | ||
Ligne 48: | Ligne 56: | ||
values | values | ||
(:name, :age, :size, :weight);""", { | (:name, :age, :size, :weight);""", { | ||
- | "name" : "Marc Lebrun", | + | "name" : "Albert Dupont", |
"age" : 49, | "age" : 49, | ||
"size" : 1.85, | "size" : 1.85, | ||
Ligne 64: | Ligne 72: | ||
cur.execute("""select * from people | cur.execute("""select * from people | ||
where name=:who and age=:age;""", { | where name=:who and age=:age;""", { | ||
- | "who": "Marc Lebrun", | + | "who": "Albert Dupont", |
"age": 49 | "age": 49 | ||
}) | }) |