- Install NodeJs
- Open the terminal and Clone this repository by running:
git clone git@github.com:HousewareHQ/houseware---data-engineering-octernship-gaurav-2-0-0-2.git
- After cloning go to the project folder and run:
npm install
- Now for running the project locally run:
node server.js
- Install duckdb CLI
- Unzip the folder in the same directory as of the project.
- In order to run the queries to show the result in terminal run:
./duckdb --init init.sql my-db.duckdb < queries/<query_name>.sql
- Download Postman
- Open postman and change the following:
i. HTTP request to POST request.
ii. Enterhttp://localhost:3000/segment
in the input box.
iii. Select Body --> raw and set JSON data.
iv. Put the JSON file's data (from the project) in the POST request body.
v. Make sure that your project is running locally.
vi. Click send button to post your JSON data and you can change the JSON data according to your need.
The specs for JSON file are:
{
"criteria":{
"field": "user_id",
"table": "user_table",
"condition":{
"parameter": "age",
"value": "30",
"operator": "between",
"conjunction": "and",
"min": "25",
"max": "34"
},
"join":{
"type": "join",
"user_alias": "a",
"event_alias": "e",
"joining_table": "event_table",
"joining_key": "user_id",
"conjunction": "and",
"parameter1": "location",
"value1":"'California'",
"parameter2": "event_name",
"value2": "'LOGIN'"
}
}
}
You will be able to see the results in the console or terminal.
This is just an example you can modify the JSON as you need.