CorgiDB.utils.create_table
CorgiDB.utils.create_table(name: str, columns: list)
this method will create_table on the connected database
Parameters
name : str
name of the table, e.g.,
"Personnel"
,"Student"
columns : list
columns contain in the table in form of
("Columns name", dtype)
in liste.g.,
[("name", str), ("age", int)]
with onlyint, float, bool, str
are supported
Returns
out : Table
CorgiDB's Table object for us to manipulate the table after the creation
Notes
Creating an already existing Table will raise an SQLite3 error
Examples
from corgidb import CorgiDB
# Connect CorgiDB to db.sqlite
cdb = CorgiDB(database_path="db.sqlite")
# Create a Table
tb = cdb.utils.create_table(
name="Employee"
columns=[
("name" , str),
("gender" , str),
("age" , int),
("height" , float),
("weight" , float)
])
Last updated