Skip to content

Instantly share code, notes, and snippets.

@minorsecond
Created April 18, 2015 00:14
Show Gist options
  • Save minorsecond/f0f54ae6cc68127c662d to your computer and use it in GitHub Desktop.
Save minorsecond/f0f54ae6cc68127c662d to your computer and use it in GitHub Desktop.
Not creating the DB for some reason.
with jobdb:
if debug == 1:
print("DEBUGGING")
print("Connected to jobdb. Data to be inserted into JOBDB Database:")
print ("Lead Name: {0}, Job Name: {1}, Job Abbrev: {2}, Time Worked: {3}, Date: {4}, UUID: {5}")\
.format(lead_name, job_name,job_abbrev, time, date, p_uuid)
cur.execute(
"INSERT INTO jobdb(UUID, Lead_name, Job_name, Job_abbrev, Time_worked, "
"Date) VALUES(?, ?, ?, ?, ?, ?)", [p_uuid, lead_name, job_name, job_abbrev, time, date]
)
jobdb.commit()
@minorsecond
Copy link
Author

The Connection is created: jobdb = sqlite3.connect('jobdb.db')

The Table is created:

with jobdb:
if debug == 1:
cur.executescript('DROP TABLE IF EXISTS jobdb')
cur.execute(
'CREATE TABLE if not exists jobdb(Id INTEGER PRIMARY KEY, UUID TEXT, Date DATE, Lead_name TEXT, Job_name TEXT
, Job_abbrev TEXT, Time_worked TEXT)')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment