· 9 years ago · Dec 05, 2016, 07:56 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);"""
16
17ownerTableSql = """ CREATE TABLE IF NOT EXISTS `owner` (
18 ID INTEGER PRIMARY KEY AUTOINCREMENT,
19 `flickr_id` integer ,
20 `location` varchar(255)
21);"""
22
23connection = sqlite3.connect('flickr-download.db')
24dbHandle = connection.cursor()
25
26dbHandle.execute(photoTableSql)
27dbHandle.execute(ownerTableSql)
28
29connection.commit()
30connection.close()