File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change
1
+ import sys
2
+ import csv
3
+ import sqlite3
4
+
5
+ if len (sys .argv ) < 3 :
6
+ print "Use: {0} DATABASE_NAME TABLE_NAME" .format (sys .argv [0 ])
7
+ exit ()
8
+
9
+ conn = sqlite3 .connect (sys .argv [1 ])
10
+ cur = conn .cursor ()
11
+ data = cur .execute ("SELECT * FROM {0}" .format (sys .argv [2 ]))
12
+
13
+ with open ('output.csv' , 'wb' ) as f :
14
+ writer = csv .writer (f )
15
+ writer .writerows (data )
16
+
17
+ conn .close ()
Original file line number Diff line number Diff line change 22
22
1 . ** 20_restore_file_from_git.py** : Restore file from Git History
23
23
1 . ** 21_twitter_bot.py** : Twitter Bot
24
24
1 . ** 22_git_tag.py** : Create Git Tag based on a commit
25
- 1 . ** 23_flask_session_test.py** : Just a simple app to see if the sessions are working.
25
+ 1 . ** 23_flask_session_test.py** : Just a simple app to see if the sessions are working
26
+ 1 . ** 24_sql2csv.py** : SQL to CSV.
You can’t perform that action at this time.
0 commit comments