Commit 22185b2
Changed files (1)
atarg
atarg/sql.py
@@ -0,0 +1,36 @@
+
+from sqlalchemy import create_engine
+from sqlalchemy.ext.declarative import declarative_base
+from sqlalchemy import Column, Integer, String, Enum, Date
+
+MYSQL_USER = "admin"
+MYSQL_PASS = "docker"
+MYSQL_ADDR = "172.17.0.37"
+MYSQL_DB = "test"
+
+engine = create_engine('mysql://%s:%s@%s/%s' % (
+ MYSQL_USER,
+ MYSQL_PASS,
+ MYSQL_ADDR,
+ MYSQL_DB), echo=True)
+Base = declarative_base()
+
+class Appointments(Base):
+ __tablename__ = 'appointments'
+ id = Column(Integer, primary_key=True)
+ visitor = Column(String(7))
+ submitter = Column(String(7))
+ start_date = Column(Date)
+ end_date = Column(Date)
+ location = Column(Enum('upstairs', 'downstiars', name="loacation_type"))
+ status = Column(Enum('verifed', 'needs tickets', 'needs pnpi', name="status_type"))
+
+ def __init__(self, visitor, submitter, start_date, end_date, location, status):
+ self.visitor = visitor
+ self.submitter = submitter
+ self.start_date = start_date
+ self.end_date = end_date
+ self.location = location
+ self.status = status
+
+Base.metadata.create_all(engine)