Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Running in Pycharm getting compile error Traceback (most recent call last): File /Users/John/PycharmProjects/N/Sprint_2/Database.py, line 46, in main() File /Users/John/PycharmProjects/N/Sprint_2/Database.py, line 44, in main createDB(data) File

Running in Pycharm getting compile error Traceback (most recent call last): File "/Users/John/PycharmProjects/N/Sprint_2/Database.py", line 46, in  main() File "/Users/John/PycharmProjects/N/Sprint_2/Database.py", line 44, in main createDB(data) File "/Users/John/PycharmProjects/N/Sprint_2/Database.py", line 36, in createDB c.executemany('INSERT INTO comp VALUES (?,?,?,?,?,?,?,?,?,?,?)', temp_values) sqlite3.IntegrityError: datatype mismatch import json import urllib import sqlite3 import temp def loading(): url = 'https://jobs.github.com/positions.json?page=1' # URL for API 1-5json_obj = urllib.urlopen(url) response = urllib.urlopen(url) data = json.load(response) # loads the url and set it into data variable for item in data[0].keys(): print(item) return data # Get the keys # def loading(): # print " LOADING API(s)" # urllib.urlopen('https://jobs.github.com/positions.json?page=1') # temp = json.dumps(data[1]) # print (json.dumps(data[1])) # print (" ") def createDB(data): conn = sqlite3.connect('comp.db') c = conn.cursor() # Create table c.execute('''CREATE TABLE IF NOT EXISTS comp (description text, title text, url text, company_logo text, company text, id integer primary key, company_url text, how_to_apply text, location text, type text, created_at timestamp)''') temp_values = list(tuple()) for item in data: print (item) list_of_values = [v for k, v in item.items()] tuple_of_values = tuple(list_of_values) temp_values.append(tuple_of_values) c.executemany('INSERT INTO comp VALUES (?,?,?,?,?,?,?,?,?,?,?)', temp_values) #TO DO # Make sub sets for each category call # put in category for each ? in table def main(): data = loading() createDB(data)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

What does this public not want on this issue?

Answered: 1 week ago

Question

What does this public want on this issue?

Answered: 1 week ago