· 9 years ago · Dec 05, 2016, 08:02 PM
1#!/usr/bin/python3
2
3import sqlite3
4
5photoTableSql = """CREATE TABLE IF NOT EXISTS `photos` (
6 ID INTEGER PRIMARY KEY AUTOINCREMENT,
7 `owner` varchar(255),
8 `date_upload` datetime,
9 `date_taken` datetime,
10 `title` varchar(255),
11 `latitude` real,
12 `longitude` real,
13 `tags` varchar(255),
14 `photo_id` INTEGER
15 PRIMARY KEY (photo_id)
16);"""
17
18ownerTableSql = """ CREATE TABLE IF NOT EXISTS `owner` (
19 ID INTEGER PRIMARY KEY AUTOINCREMENT,
20 `flickr_id` integer ,
21 `location` varchar(255)
22);"""
23
24connection = sqlite3.connect('flickr-download.db')
25dbHandle = connection.cursor()
26
27dbHandle.execute(photoTableSql)
28dbHandle.execute(ownerTableSql)
29
30connection.commit()
31connection.close()