-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use sqlite as database #126
Conversation
Is this implementation okay? let's finalize for one table and then we will do it similarly for other tables |
So... I left contest and question database as work has to be done with that in #119 |
The indexing docs might be of help
What relations do you have in mind? I think linking between question,contest,submission,user should happen.
That's fine for now. Things will settle in a while. Let's get to a point where we can stop using |
Database fully implemented (almost).
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going in the right direction. 👍
Let's get the relations done
Co-Authored-By: Arjoonn Sharma <[email protected]>
I got some problems implementing relationships, can't really understand it. |
so foreign keys are a exactly what you mentioned. Simply numbers appearing in another table. But that is at the database level (mysql/sqlite). Right now we are using peewee which is an ORM. So in our case: class Base(pw.Model):
class Meta:
database = db
class Question(Base):
instructions = pw.CharField()
class Contest(Base):
title = pw.CharField()
class QuesInContest(Base):
question = pw.ForeignKeyField(Question)
contest = pw.ForeignKeyField(Contest) Peewee handles the index-integer-autoincrement thing for us. We just give it the class. Now to insert things into contest = Contest.create(...)
ques = Question.create(...)
q_in_c = QuesInContest.create(question=ques, contest=contest)
# or you could supply IDs ( for example when ID is a parameter in an API)
qid = int(ques.id)
cid = int(contest.id)
q_in_c = QuesInContest.create(question=qid, contest=cid) |
I'd prefer to keep master in a working state always so if you could wrap up the relations thing also in this PR it would be wonderful! |
I'll give it a shot :) |
Should I implement the question table in this too? |
It'll be nice if this was a full system 😊
…On Tue 21 May, 2019, 08:47 Rishabh Kalakoti, ***@***.***> wrote:
Should I implement the question table in this too?
—
You are receiving this because your review was requested.
Reply to this email directly, view it on GitHub
<#126?email_source=notifications&email_token=AB2WHUMEBYZSNWITRGI5DATPWNSV7A5CNFSM4HN3X7N2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODV2UGBQ#issuecomment-494224134>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB2WHUMZL3XM2LLLZSM6K5DPWNSV7ANCNFSM4HN3X7NQ>
.
|
The database system looks ready to me now. |
This is starting to make sense! 👍 |
use sqlite as database (PyJaipur#126)
fixes #118
TODO