Question: In this assignment we are going to work with a larger collection of tweets (10,000) that are available here: http://rasinsrv07.cstcis.cti.depaul.edu/CSC455/Assignment5.txt The tweets are all on

In this assignment we are going to work with a larger collection of tweets (10,000) that are available here: http://rasinsrv07.cstcis.cti.depaul.edu/CSC455/Assignment5.txt The tweets are all on separate lines, but some of the tweets are intentionally damaged and will not parse properly. You will need to store these tweets in a separate error file. At the bottom of the page you can find python code that will let you skip over badly formed tweets. a. Create a new SQL table for the user dictionary. It should contain the following attributes id, name, screen_name, description and friends_count. Modify your SQL table from Assignment 4 to include user_id which will be a foreign key referencing the user table. b. Write python code that is going to read and load the Assignment5.txt file from the web and populate both of your tables (Tweet table from Assignment4 and User table from this assignment). For tweets that could not parse, write them into Assignment5_errors.txt file (do not ignore). You can gracefully catch JSON errors using the following code: for tweet in allTweets: try: tdict = json.loads(tweet.decode('utf8')) except ValueError: # Handle the problematic tweet, which in your case would require writing it to another file print (tweet) As discussed in class, you can access the contents of the user dictionary after it was parsed by json like this: dict['user'] # user dictionary dict['user']['id'] # users ID

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!