Commit 2eb913dd authored by Thathsarani R.P.H.S.R's avatar Thathsarani R.P.H.S.R

Merge branch 'IT20201364_Thathsarani_R.P.H.S.R'

parents 360b8ddd aca245e2
import sqlite3
import csv
# Replace 'your_database.db' with the path to your SQLite database file
db_file = 'database1.db'
# Connect to the database
conn = sqlite3.connect(db_file)
cursor = conn.cursor()
# Get a list of table names in the database
cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables = cursor.fetchall()
# Export each table to a CSV file
for table in tables:
table_name = table[0]
cursor.execute(f"SELECT * FROM {table_name};")
data = cursor.fetchall()
with open(f'{table_name}.csv', 'w', newline='') as csv_file:
csv_writer = csv.writer(csv_file)
csv_writer.writerow([i[0] for i in cursor.description]) # Write column headers
csv_writer.writerows(data) # Write table data
# Close the database connection
conn.close()
id,user_id,stress_level,login_time
1,1,Low Stress,2023-09-04 02:09:10.046792
2,1,Low Stress,2023-09-04 02:14:22.615992
3,1,Low Stress,2023-09-04 02:17:57.890788
4,2,Low Stress,2023-09-04 02:19:22.424843
5,2,Low Stress,2023-09-04 02:29:28.067208
6,2,Low Stress,2023-09-04 02:29:38.365879
7,2,Low Stress,2023-09-04 02:31:29.337577
8,2,Low Stress,2023-09-04 03:17:12.033551
9,2,Low Stress,2023-09-04 03:20:49.430136
10,2,Low Stress,2023-09-04 03:21:46.483664
11,2,Low Stress,2023-09-04 03:23:07.635679
12,2,Low Stress,2023-09-04 03:50:57.128479
13,2,Low Stress,2023-09-04 04:04:46.065441
14,2,Low Stress,2023-09-04 04:04:54.386899
15,2,Low Stress,2023-09-04 04:05:01.021313
16,5,High Stress,2023-09-10 17:53:04.058277
17,6,Low Stress,2023-09-10 18:00:05.266873
18,6,High Stress,2023-09-10 18:22:47.963209
19,6,Low Stress,2023-09-10 18:32:59.041052
20,6,Low Stress,2023-09-20 05:56:20.890722
21,2,Low Stress,2023-09-24 11:58:12.844671
22,2,High Stress,2023-09-24 12:07:15.183628
23,2,Low Stress,2023-09-24 12:18:05.035186
24,2,High Stress,2023-09-24 12:23:04.841071
25,2,Low Stress,2023-09-24 12:27:03.852818
26,2,Low Stress,2023-09-24 12:32:01.005196
27,2,Low Stress,2023-09-24 12:33:37.855039
28,2,Low Stress,2023-09-24 14:47:11.395236
29,2,Low Stress,2023-09-24 14:50:56.981253
30,2,Low Stress,2023-09-24 14:51:06.199173
31,2,Low Stress,2023-09-24 14:54:57.364426
32,2,Low Stress,2023-09-24 15:01:20.060194
33,2,Low Stress,2023-09-24 15:04:35.779110
34,2,High Stress,2023-09-24 15:11:00.195472
35,2,Low Stress,2023-09-24 15:15:18.488271
36,2,Low Stress,2023-09-24 15:18:04.724282
37,2,High Stress,2023-09-24 15:19:43.288489
38,2,Low Stress,2023-09-24 15:24:39.461475
39,7,Low Stress,2023-09-24 15:27:40.766537
40,7,High Stress,2023-09-24 15:33:15.379655
41,7,High Stress,2023-09-24 15:34:58.994566
42,7,High Stress,2023-09-24 15:37:09.343170
43,7,High Stress,2023-09-24 15:48:52.740542
44,7,High Stress,2023-09-24 15:53:05.650621
45,7,Low Stress,2023-09-24 16:02:50.766382
46,7,High Stress,2023-09-24 16:14:15.251642
47,7,Low Stress,2023-09-24 16:19:17.576673
48,9,Low Stress,2023-10-08 14:14:57.526348
49,9,Low Stress,2023-10-08 14:22:38.365888
50,9,High Stress,2023-10-08 14:32:42.776305
51,9,High Stress,2023-10-23 18:00:12.777186
52,9,Low Stress,2023-10-24 11:57:55.422896
53,9,Low Stress,2023-10-24 12:00:42.583233
54,9,Low Stress,2023-10-24 13:54:26.068150
55,9,High Stress,2023-10-24 14:22:05.448665
56,9,Low Stress,2023-10-24 14:24:46.709832
57,9,High Stress,2023-10-24 19:01:53.038570
58,9,High Stress,2023-10-24 19:12:34.385029
59,9,Low Stress,2023-10-24 20:26:59.538909
60,9,Low Stress,2023-10-25 06:54:45.665753
61,9,Low Stress,2023-10-25 06:55:48.812514
62,9,High Stress,2023-10-25 06:58:50.403229
63,9,High Stress,2023-10-25 07:05:11.398949
64,9,High Stress,2023-10-25 14:26:36.552298
65,9,Low Stress,2023-10-25 19:27:44.577586
66,9,Low Stress,2023-10-25 19:33:36.003595
67,9,High Stress,2023-10-26 08:30:50.520901
68,9,High Stress,2023-10-26 08:33:36.929613
id,username,password,login_time
1,naleen,sha256$2ud7wS1vQSK7acOH$4e01233aa2e9cfe198b3c012e52e91ed3513db6a40c505b2debea92d39c49b7a,2023-09-04 02:09:04.863399
2,malith,sha256$T4wv7xCra6BJRTbV$4e40293378b894c5de88d4259b44d476e1599aac660c771ad4ff516c2adc6c19,2023-09-10 13:38:43.960452
3,hashini,sha256$jPmIJdTnQ4nJP0GH$6f1fcdd54b13ea3fdd18e0d202d7cd4e8f19f4ab51b0b06e575959bc2a0088fa,2023-09-04 09:30:45.621237
4,anurada,sha256$iWsBqHKgcLTfCg1d$1d554735725629349b5eda70b54944a7922eac1d6325ba0e018d5579d6a1f789,2023-09-09 04:23:59.702022
5,manoj,sha256$Dof4YHqqaGwwk0K1$26b824ac215b2515b085a97979272143532f8cb90e0dcb0fe00aacf42ba89fc1,2023-09-10 17:28:31.379206
6,raveen,sha256$Eo0W91gLXK3lxCov$4be67ecb3cc389af93aa266eca25d3ddef53d1de7d4c0203f2e183dfbc4462c3,2023-09-10 17:59:16.633522
7,Malith,sha256$0qLke7Gm6NF4M4FP$78a94289b90b7adc1eb2a457dcdd9634e5aca66631382d5cf4a959d16948ea99,2023-09-24 15:26:44.303684
8,Theekshana,sha256$XptJL2SfLPQTp5ER$f3b784c37ca24fb569156a0062e4bab1d3e9a977583ff607d1757cb84c8553a7,2023-09-24 16:14:58.530891
9,Sewmini,sha256$KJPugp57jBU2gW6X$9be68bdb6f0d1a003d958e2660f047e6d5d556451743e0bd10018e907ee6902c,2023-10-08 14:11:36.372259
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment