We have separate pages for maintaining some Project metrics. Few metrics are common but some are applicable only for specific project. Using Python with Selenium and SQLite. Have written code to fetch data from specific page and store in a runtime SQL table.
Sample data and expected result Project_A:
Project_Name | Month | Metric1 | Metric2 |
---|---|---|---|
A | Jan-21 | 12 | 5 |
A | Feb-21 | 15 | 10 |
Project_B:
Project_Name | Month | Metric1 | Metric3 |
---|---|---|---|
B | Jan-21 | 05 | 5 |
B | Feb-21 | 20 | 10 |
Want to create one master table which will contain all the projects with their metrics. I can use a union, a query like below and combine the data from different table.
SELECT Project_Name , Metric1, Metric2, Null as Metric3 FROM Project_A
Union
Select Project_Name , Metric1, Null as Metric2, Metric3 FROM Project_B
Combined Result:
Project_Name | Month | Metric1 | Metric2 | Metric3 |
---|---|---|---|---|
A | Jan-21 | 12 | 5 | |
A | Feb-21 | 15 | 10 | |
B | Jan-21 | 05 | 5 | |
B | Feb-21 | 20 | 10 |
Challenge isLooking if any option is there were, we can combine tables without mentioning the column names.