Skip to content

Commit

Permalink
Address suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
sansyrox committed Oct 29, 2023
1 parent 0b62e83 commit 5b69450
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
3 changes: 2 additions & 1 deletion robyn/scaffold/postgres/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
robyn
psycopg2
psycopg2; platform_system=="Windows"
psycopg2-binary; platform_system!="Windows"
Empty file.
17 changes: 2 additions & 15 deletions robyn/scaffold/sqlalchemy/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from robyn import Robyn
from sqlalchemy import create_engine, Column, Integer, String, Boolean
from sqlalchemy.orm import declarative_base, sessionmaker
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker


engine = create_engine("sqlite+pysqlite:///:memory:", echo=True)
Expand All @@ -16,17 +16,4 @@ def index():

if __name__ == "__main__":
# create a configured "Session" class
Base = declarative_base()

class User(Base):
__tablename__ = "users"

id = Column(Integer, primary_key=True, index=True)
username = Column(String, unique=True, index=True)
hashed_password = Column(String)
is_active = Column(Boolean, default=True)
is_superuser = Column(Boolean, default=False)

Base.metadata.create_all(bind=engine)

app.start(host="0.0.0.0", port=8080)
18 changes: 18 additions & 0 deletions robyn/scaffold/sqlalchemy/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from sqlalchemy.orm import declarative_base
from sqlalchem.orm import Column, Integer, String, Boolean

Base = declarative_base()


class User(Base):
__tablename__ = "users"

id = Column(Integer, primary_key=True, index=True)
username = Column(String, unique=True, index=True)
hashed_password = Column(String)
is_active = Column(Boolean, default=True)
is_superuser = Column(Boolean, default=False)


if __name__ == "__main__":
Base.metadata.create_all(bind=engine)

0 comments on commit 5b69450

Please sign in to comment.