geomon/gschliefgraben_glasfaser/create_db.py

26 lines
640 B
Python

from sqlalchemy import create_engine
from sqlalchemy import MetaData
from sqlalchemy import Table
from sqlalchemy import Column
from sqlalchemy import Integer, String
db_url = 'sqlite:///db.sqlite'
engine = create_engine(db_url )
# Create a metadata instance
metadata = MetaData(engine)
# Declare a table
table = Table('Example',metadata,
Column('id',Integer, primary_key=True),
Column('name',String))
# Create all tables
students = Table(
'students', metadata,
Column('id', Integer, primary_key = True),
Column('name', String),
Column('lastname', String),
)
metadata.create_all(engine)