'How to join multiple tables using GridDB?

I have 4 tables in a database; I want to join those four tables into a single table. Is there a way to do that? I’m using GridDB on Ubuntu and I’m using the griddb_python library. Since griddb supports a few SQL queries, I need an SQL query to do what I want. Thanks! The snippet below contains a sample of four tables and how I stored one of the tables inside a GridDB container:

"""
EMPLOYEES DATABASE
Note: All dates are actually timestamps

employees
emp_no  |  birth_date  |  first_name  |  last_name  |  gender  |  hire_date
-----------+----------------+----------------+----------------+-----------+---------------
23           |21/05/1988  |      Frank       |      Phillips   |    Male    | 13/02/2020
54           |13/07/1989  |      John        |      Peters     |   Male     | 19/12/2020
53           |07/03/1981  |     Stephen    |    Stevenson|    Male    | 20/09/2020
98           |23/04/1994  |     Janet        |        Davis    |   Female | 25/05/2020
08           |04/02/1992  |       Ben         |      Cornwell|    Male    | 15/02/2020
...

salaries
emp_no  |  salary  |  from_date  |  to_date
-----------+-----------+---------------+-------------
23           | 120000 |13/02/2020  |13/02/2021 
...


titles
emp_no  |           title       |  from_date |  to_date
-----------+-------------------+---------------+-------------
23           | Sales Manager |13/02/2020  |13/02/2021 
...


dept_emp
emp_no  |  dept_no   |  from_date |  to_date  
-----------+--------------+---------------+------------
23           |  09            |13/02/2020  |13/02/2021
...
"""

## Some codes have been deleted, this code is incomplete
factory = griddb.StoreFactory.get_instance()

## Initializing the container
try:
    gridstore = factory.get_store(host="127.0.0.1",
                                  port=59211,
                                  cluster_name="cluster_one",
                                  username="admin",
                                  password="")

    ## Defining the container info
    """The following code snippet is for the employees table"""
    conInfo = griddb.ContainerInfo("employees",
                    [["emp_no", griddb.Type.INTEGER],
                     ["birth_date", griddb.Type.TIMESTAMP],
                     ["first_name", griddb.Type.STRING]],
                     ["last_name", griddb.Type.STRING],
                     ["gender", griddb.Type.STRING],
                     ["hire_date", griddb.Type.TIMESTAMP]],
                    griddb.ContainerType.COLLECTION, True)
    container = gridstore.put_container(conInfo)
    ## Reading the database with pandas
    data = pd.read_csv("employees.csv")

    ## Adding the database to the container
    for i in range(len(data)):
        ret = container.put(data.iloc[i, :])
    print("Data added successfully")


except Exception as e:
    print("Error: ", e)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source