mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 01:14:31 +02:00
add-column col_type now optional, defaults to str
This commit is contained in:
parent
557dc3f9a7
commit
3cab079d3e
6 changed files with 18 additions and 8 deletions
|
|
@ -232,9 +232,12 @@ You can add a new column to a table using the ``.add_column(col_name, col_type)`
|
|||
db["dogs"].add_column("weight", float)
|
||||
db["dogs"].add_column("dob", datetime.date)
|
||||
db["dogs"].add_column("image", "BLOB")
|
||||
db["dogs"].add_column("website") # str by default
|
||||
|
||||
You can specify the ``col_type`` argument either using a SQLite type as a string, or by directly passing a Python type e.g. ``str`` or ``float``.
|
||||
|
||||
The ``col_type`` is optional - if you omit it the type of ``TEXT`` will be used.
|
||||
|
||||
SQLite types you can specify are ``"TEXT"``, ``"INTEGER"``, ``"FLOAT"`` or ``"BLOB"``.
|
||||
|
||||
If you pass a Python type, it will be mapped to SQLite types as shown here::
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue