Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sqlite3
- from datetime import date
- conn = sqlite3.connect(':memory:')
- cur = conn.cursor()
- #creating table
- cur.execute('create table first (number integer, firstdate real, seconddate2 real, summ float, paid float, diff float)')
- def dtj(my_date):
- """Returns the Julian day number of a date."""
- a = (14 - my_date.month)//12
- y = my_date.year + 4800 - a
- m = my_date.month + 12*a - 3
- return my_date.day + ((153*m + 2)//5) + 365*y + y//4 - y//100 + y//400 - 32045
- dates = [dtj(date(2013, 12, 31)), dtj(date(2014, 1, 4))]
- #filling it with input data
- cur.executemany('insert into first values (123456, ?, ?, 99999.99, 99999.99, 0)', dates)
- for row in cur.execute('select * from first order by number'):
- print row
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement