Skip to content
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

Updating a partially downloaded question #23

Open
6 tasks
DSuveges opened this issue Aug 11, 2023 · 1 comment
Open
6 tasks

Updating a partially downloaded question #23

DSuveges opened this issue Aug 11, 2023 · 1 comment

Comments

@DSuveges
Copy link
Owner

If at some later time, the database needs to be re-freshed, we can fetch new questions and avoid downloading questions that are already in the database however there might be new answers. How to fetch only those questions that got new answers?

Logic:

  • For each question ID on a page, retrieve the number of answers.
  • For each question ID retrieve the number of answers submitted by other than the OP.
  • If these numbers are different, but the question ID is in the DB do the following:
  • Remove row with question id from the questions table
  • Remove rows with question id from the answers table.
  • Remove rows with question id from the question keyword table.
  • Then process question.

Tasks:

  • Add functionality to return number of answers from the parserd html
  • Add sql to return the number of answers submitted by other than the OP
  • Add sql to drop question by question id
  • Add sql to drop answers by question id
  • Add sql to drop keyword link by question id
  • Add logic to
@DSuveges
Copy link
Owner Author

The problem is, deleting the question is not allowed as there are dependent tables in the database. However, there's an option to use cascading delete that performs an automatic delete from all tables where the foreign key found. The only caveat is that it has to be specified upon database creation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant