
# Kube app library process flow documentation

## Pre-requisites
Python installation documentation

Python installation for windows 8 and above.
[Documentation](https://linktodocumentation)

pip installation for windows 8 and above.
[Documentation](https://linktodocumentation)

## Installation

### Supported for all macOS/linux/windows.
There are some prerequisite which need to be considered before using this sdk and they have been covered in previous section.

Install kube-app sdk with pip.
```bash
  pip install kube-app
```

## Method:

### pushData(source_data,table,overwrite)

Using pushData method data can be inserted into table schema already defined in kube database.

```bash
  import kube_app as k
  client = k.Client('API_KEY','SECRET_KEY')
  client.pushData(source_data,table,overwrite)
```

### Request Parameters:

Here is the list of parameters for pushing data into kube database:

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| `source_data` | `pandas dataframe` | source_data is pandas dataframe which is generated by the user. |
| `table` | `string` | table is string value which can be: sales,sales_order,calendar,ar,logs,target. |
| `overwrite` | `boolean` | overwrite can be True or False. overwrite is True by default and when it is False then data is appended in current table. |

### Output:
#### boolean: True

The output is a boolean value True which suggests data is inserted into kube database.

![Alt Text](https://chatimgs.blob.core.windows.net/kube-docs/pushData.png)

### getSchema(table)

Using getSchema method schema details for all tables present are extracted as pandas dataframe.

```bash
  import kube_app as k
  client = k.Client('API_KEY','SECRET_KEY')
  client.getSchema(table)
```

### Request Parameters:

Here is the list of parameters to get schema details from kube database:

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| 
| `table` | `string` | table is string value which can be: sales,sales_order,calendar,ar,logs,target. |

### Output:
#### boolean: True

The output is a pandas dataframe.

![Alt Text](https://chatimgs.blob.core.windows.net/kube-docs/getSchema.png)

### getData(table)

Using getData method data can be extracted from kube database.

```bash
  import kube_app as k
  client = k.Client('API_KEY','SECRET_KEY')
  client.getData(table)
```

### Request Parameters:

Here is the list of parameters for pushing data into kube database:

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| 
| `table` | `string` | table is string value which can be: sales,sales_order,calendar,ar,logs,target. |

### Output:
#### boolean: True

The output is a pandas dataframe.

![Alt Text](https://chatimgs.blob.core.windows.net/kube-docs/getData.png)

### generateCalendarData(start_month,start_year,end_year)

Using generateCalendarData method calendar can be generated which can be later pushed into kube database using pushData method.

```bash
  import kube_app as k
  client = k.Client('API_KEY','SECRET_KEY')
  client.getCalendarData(04,2023,2024)
```

### Request Parameters:

Here is the list of parameters for pushing data into kube database:

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| 
| `start_month` | `integer` | start_month is integer value between 1 to 12. |
| `start_year` | `integer` | start_year is an integer value. |
| `end_year` | `integer` | end_year is an integer value more than start_year. |

### Output:
#### boolean: True

The output is a pandas dataframe.

![Alt Text](https://chatimgs.blob.core.windows.net/kube-docs/generateCalendarData.png)

### deleteTable(table)

Using generateCalendarData method calendar can be generated which can be later pushed into kube database using pushData method.

```bash
  import kube_app as k
  client = k.Client('API_KEY','SECRET_KEY')
  client.deleteTable('sales')
```

### Request Parameters:

Here is the list of parameters for pushing data into kube database:

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| 
| `table` | `string` | table is string value which can be: sales,sales_order,calendar,ar,logs,target. |

### Output:
#### boolean: True

The output is a pandas dataframe.

![Alt Text](https://chatimgs.blob.core.windows.net/kube-docs/deleteTable.png)

### getSampleData(table)

Using getSampleData method sample data can be viewed in the form of pandas dataframe and later can be used to push into kube database using pushData method.

```bash
  import kube_app as k
  client = k.Client('API_KEY','SECRET_KEY')
  client.getSampleData('sales')
```

### Request Parameters:

Here is the list of parameters for pushing data into kube database:

| Parameter | Type     | Description                |
| :-------- | :------- | :------------------------- |
| 
| `table` | `string` | table is string value which can be: sales,sales_order,calendar,ar,logs,target. |

### Output:
#### boolean: True

The output is a pandas dataframe.

![Alt Text](https://chatimgs.blob.core.windows.net/kube-docs/generateCalendarData.png)


