我已经用Python把数据导入到一个SQLite3数据库中,我有15个表。
我想检查每个表中的结果,并为加载的每个文件计数。
- 预期结果:**
+---------------+------------+-------------------------------------------+
| Tablename | #Records | FilenameImported |
+---------------+------------+-------------------------------------------+
| Tbl_RawData1 | 23680 | 442953-63fe-45fd-8378-c5f5fe5cb755.csv |
| Tbl_RawData2 | 13358 | bd3e609f-999f-4d29-845d-107bd5e205d6.csv |
| Tbl_RawData3 | 25000 | Import.csv |
| Tbl_RawData4 | 15000 | Importbis.csv |
+---------------+------------+-------------------------------------------+
...
- 在dbeaver中使用的查询下面。**
select count(FileBase), FileBase from Tbl_RawData1 group by Filebase
select count(FileBase), FileBase from Tbl_RawData2 group by Filebase
select count(FileBase), FileBase from Tbl_RawData3 group by Filebase
select count(FileBase), FileBase from Tbl_RawData4 group by Filebase
select count(FileBase), FileBase from Tbl_RawData5 group by Filebase
...
在Python中做这件事的最好方法是什么?
1条答案
按热度按时间nhhxz33t1#
在这个帖子中的答案学分:List of tables, db schema, dump etc using the Python sqlite3 API