Task: equi-join-detect (source dataset: Auto-BI)

Your are given a database with related tables used for business intelligence analysis. Your task is to identify all key/foreign-key join relationships between the tables for this database. Recall that a join is a relationship between two tables, that allows rows from one table to be combined with rows from another, based on a set of common join columns.
 
 
No explanation needed. Please return all join relationships in the following JSON format:
{
  "joins": [
    {
      "from_table": "table-1",
      "from_column": "column-1",
      "to_table": "table-2",
      "to_column": "column-3"
    }, 
	...
  ]
}

Tables:

Table: DeviationSurveys
|   WellId |   MD |   Incl |    Azm |
|---------:|-----:|-------:|-------:|
|        3 |  188 |   0.48 | 326    |
|        3 |  213 |   0.31 | 355.71 |
|        3 |  273 |   0.4  | 359    |
|        3 |  399 |   0.48 | 338    |
|        3 |  556 |   0.7  | 330.13 |
|        3 |  743 |   0.48 |  28.14 |
|        3 |  838 |   0.79 |  28.8  |
|        3 |  931 |   1.1  |  39.52 |
|        3 | 1026 |   1.41 |  45.3  |
|        3 | 1218 |   0.4  |  71.73 |


Table: metric (2)
|   well_id |   timestamp_epoch |   clean_total |   slurry_rate |   treating_pressure |   friction_reducer |   job_time |   HP_Lim |   PSI_Lim |   Stage_Active |
|----------:|------------------:|--------------:|--------------:|--------------------:|-------------------:|-----------:|---------:|----------:|---------------:|
|         2 |       1.51004e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |       90 |      9000 |              1 |
|         2 |       1.51004e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |       90 |      9000 |              1 |
|         2 |       1.51004e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |       90 |      9000 |              1 |
|         2 |       1.51004e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |       90 |      9000 |              1 |
|         2 |       1.51004e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |       90 |      9000 |              1 |
|         2 |       1.51004e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |       90 |      9000 |              1 |
|         2 |       1.51004e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |       90 |      9000 |              1 |
|         2 |       1.51004e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |       90 |      9000 |              1 |
|         2 |       1.51004e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |       90 |      9000 |              1 |
|         2 |       1.51004e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |       90 |      9000 |              1 |


Table: metric
|   well_id |   timestamp_epoch |   HP_Lim |   PSI_Lim |   clean_total |   slurry_rate |   treating_pressure |   friction_reducer |   job_time |   Stage_Active |   Delta_SR |   Zero__Time |   Stage_Time |   Delta_PSI |   Stage_Time.1 |    AVG_HP |   Avg_HP_ |   AVG_PSI |
|----------:|------------------:|---------:|----------:|--------------:|--------------:|--------------------:|-------------------:|-----------:|---------------:|-----------:|-------------:|-------------:|------------:|---------------:|----------:|----------:|----------:|
|         1 |        1509440017 |       90 |      9000 |       167.265 |     0.11747   |             1451.88 |                  0 |    173.567 |              0 |    89.8825 |         5755 |         5755 |     7548.12 |              0 | 0.0290643 | 0.0290643 |   2978.26 |
|         1 |        1509440022 |       90 |      9000 |       167.265 |     0.11      |             1441.38 |                  0 |    173.65  |              0 |    89.89   |         5760 |         5760 |     7558.62 |              0 | 0.0290391 | 0.0290391 |   2978.26 |
|         1 |        1509440027 |       90 |      9000 |       167.265 |     0.11      |             1445.75 |                  0 |    173.733 |              0 |    89.89   |         5765 |         5765 |     7554.25 |              0 | 0.0290139 | 0.0290139 |   2978.26 |
|         1 |        1509440032 |       90 |      9000 |       167.265 |     0.09      |             1432.44 |                  0 |    173.817 |              0 |    89.91   |         5770 |         5770 |     7567.56 |              0 | 0.0289887 | 0.0289887 |   2978.26 |
|         1 |        1509440037 |       90 |      9000 |       167.265 |     0.09      |             1444.85 |                  0 |    173.9   |              0 |    89.91   |         5775 |         5775 |     7555.15 |              0 | 0.0289636 | 0.0289636 |   2978.26 |
|         1 |        1509440042 |       90 |      9000 |       167.265 |     0.0977136 |             1462.35 |                  0 |    173.983 |              0 |    89.9023 |         5780 |         5780 |     7537.65 |              0 | 0.0289386 | 0.0289386 |   2978.26 |
|         1 |        1509440047 |       90 |      9000 |       167.265 |     0.1       |             1453.54 |                  0 |    174.067 |              0 |    89.9    |         5785 |         5785 |     7546.46 |              0 | 0.0289136 | 0.0289136 |   2978.26 |
|         1 |        1509440052 |       90 |      9000 |       167.265 |     0.0922784 |             1442.04 |                  0 |    174.15  |              0 |    89.9077 |         5790 |         5790 |     7557.96 |              0 | 0.0288886 | 0.0288886 |   2978.26 |
|         1 |        1509440057 |       90 |      9000 |       167.265 |     0.0825984 |             1447.64 |                  0 |    174.233 |              0 |    89.9174 |         5795 |         5795 |     7552.36 |              0 | 0.0288637 | 0.0288637 |   2978.26 |
|         1 |        1509440062 |       90 |      9000 |       167.265 |     0.09      |             1432.41 |                  0 |    174.317 |              0 |    89.91   |         5800 |         5800 |     7567.59 |              0 | 0.0288388 | 0.0288388 |   2978.26 |


Table: metric_str
|   row_id |   well_id | timestamp_dt            |   timestamp_epoch | metric_name   | metric_value   |
|---------:|----------:|:------------------------|------------------:|:--------------|:---------------|
|    21575 |         1 | 2017-11-01 06:48:02.000 |        1509518882 | job_time      | 00:48:00       |
|    38136 |         2 | 2017-11-06 06:48:02.000 |        1509950882 | job_time      | 00:48:00       |
|    55363 |         2 | 2017-11-07 06:48:42.000 |        1510037322 | job_time      | 00:48:00       |
|    55364 |         2 | 2017-11-07 06:48:47.000 |        1510037327 | job_time      | 00:48:00       |
|    55365 |         2 | 2017-11-07 06:48:02.000 |        1510037282 | job_time      | 00:48:00       |
|    55366 |         2 | 2017-11-07 06:48:22.000 |        1510037302 | job_time      | 00:48:00       |
|    55367 |         2 | 2017-11-07 06:48:27.000 |        1510037307 | job_time      | 00:48:00       |
|    55368 |         2 | 2017-11-07 06:48:32.000 |        1510037312 | job_time      | 00:48:00       |
|    55369 |         2 | 2017-11-07 06:48:07.000 |        1510037287 | job_time      | 00:48:00       |
|    55370 |         2 | 2017-11-07 06:48:37.000 |        1510037317 | job_time      | 00:48:00       |


Table: Perforations
|   WellId |   Top |   Btm |
|---------:|------:|------:|
|        1 |  9047 |  9183 |
|        1 |  9248 |  9380 |
|        1 |  9449 |  9585 |
|        1 |  9650 |  9786 |
|        1 |  9851 |  9987 |
|        1 | 10055 | 10188 |
|        1 | 10253 | 10389 |
|        1 | 10451 | 10590 |
|        1 | 10655 | 10793 |
|        1 | 10856 | 10992 |


Table: vw_completions
|   well_id |   timestamp_epoch |   clean_total |   slurry_rate |   treating_pressure |   friction_reducer |   job_time |
|----------:|------------------:|--------------:|--------------:|--------------------:|-------------------:|-----------:|
|         2 |       1.51005e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |
|         2 |       1.5101e+09  |       3199.82 |          0.11 |              625.24 |                  0 |         48 |
|         2 |       1.51005e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |
|         2 |       1.51008e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |
|         2 |       1.51007e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |
|         2 |       1.51009e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |
|         2 |       1.51006e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |
|         2 |       1.5101e+09  |       3199.82 |          0.11 |              625.24 |                  0 |         48 |
|         2 |       1.51009e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |
|         2 |       1.51009e+09 |       3199.82 |          0.11 |              625.24 |                  0 |         48 |


Table: Wells
| WellName   |   WellId |
|:-----------|---------:|
| Agate      |        1 |
| Arabian    |        2 |
| Taipan     |        3 |

 


tables: name: DeviationSurveys
data: DeviationSurveys.csv
name: metric (2)
data: metric (2).csv
name: metric
data: metric.csv
name: metric_str
data: metric_str.csv
name: Perforations
data: Perforations.csv
name: vw_completions
data: vw_completions.csv
name: Wells
data: Wells.csv
label: DeviationSurveys
WellId
Wells
WellId
Perforations
WellId
Wells
WellId
metric_str
well_id
Wells
WellId
metric
well_id
Wells
WellId
metric (2)
well_id
Wells
WellId
vw_completions
well_id
Wells
WellId
output: {
    "joins": [
        {
            "from_table": "DeviationSurveys",
            "from_column": "WellId",
            "to_table": "Wells",
            "to_column": "WellId"
        },
        {
            "from_table": "Perforations",
            "from_column": "WellId",
            "to_table": "Wells",
            "to_column": "WellId"
        },
        {
            "from_table": "metric_str",
            "from_column": "well_id",
            "to_table": "Wells",
            "to_column": "WellId"
        },
        {
            "from_table": "metric",
            "from_column": "well_id",
            "to_table": "Wells",
            "to_column": "WellId"
        },
        {
            "from_table": "metric (2)",
            "from_column": "well_id",
            "to_table": "Wells",
            "to_column": "WellId"
        },
        {
            "from_table": "vw_completions",
            "from_column": "well_id",
            "to_table": "Wells",
            "to_column": "WellId"
        }
    ]
}