|
| 1 | +# Database Connector |
| 2 | + |
| 3 | +Database connector is a service for extracting data from specific databases.\ |
| 4 | +Run container from built image and configure appropriate plugin to call it. |
| 5 | + |
| 6 | +The container takes via environment variable INGESTION_URL, which must match the url of the Ingestion Api. |
| 7 | + |
| 8 | +## Database Api |
| 9 | + |
| 10 | +This Rest service exposes one endpoint: |
| 11 | + |
| 12 | + |
| 13 | +### Execute Database enpoint |
| 14 | + |
| 15 | +Call this endpoint to execute a crawler that extract tables from Database |
| 16 | + |
| 17 | +This endpoint takes different arguments in JSON raw body: |
| 18 | + |
| 19 | +- **dialect**: Database name such as 'mysql', 'oracle', 'postgresql', etc. (required) |
| 20 | +- **driver**: Database driver (e.g., psycopg2, pymysql). (required) |
| 21 | +- **username**: Database username. (required) |
| 22 | +- **password**: Database password. (required) |
| 23 | +- **host**: Database server address (IP or domain). (required) |
| 24 | +- **port**: Port number for database connection. (required) |
| 25 | +- **db**: Name of the database to connect to. (required) |
| 26 | +- **table**: Name of the table to extract (required) |
| 27 | +- **columns**: Name of the columns to extract (optional, if not specified extract all columns) |
| 28 | +- **where**: Where condition used for extraction (optional, if not specified extract without conditions) |
| 29 | +- **datasourceId**: id of datasource |
| 30 | +- **tenantId**: id of tenant |
| 31 | +- **scheduleId**: id of schedulation |
| 32 | +- **timestamp**: timestamp to check data to be extracted |
| 33 | + |
| 34 | +Follows an example of Curl call: |
| 35 | + |
| 36 | +``` |
| 37 | +curl --location --request POST 'http://localhost:5000/getData' \ |
| 38 | +--header 'Content-Type: application/json' \ |
| 39 | +--data-raw '{ |
| 40 | + "dialect": "mysql", |
| 41 | + "driver": pymysql, |
| 42 | + "username": "admin", |
| 43 | + "password": "password", |
| 44 | + "host": "localhost", |
| 45 | + "port": "8080", |
| 46 | + "db": "mydb", |
| 47 | + "table": "test_table", |
| 48 | + "columns": [], |
| 49 | + "where": "", |
| 50 | + "datasourceId": 1, |
| 51 | + "tenantId": "1", |
| 52 | + "scheduleId": "1", |
| 53 | + "timestamp": 0 |
| 54 | +}' |
| 55 | +``` |
| 56 | + |
| 57 | +### Health check endpoint |
| 58 | + |
| 59 | +Call this endpoint to perform health check for service. |
| 60 | + |
| 61 | +Follows an example of Curl call: |
| 62 | + |
| 63 | +``` |
| 64 | +curl --location --request POST 'http://localhost:5000/health' |
| 65 | +``` |
| 66 | + |
| 67 | +### Get sample endpoint |
| 68 | + |
| 69 | +Call this endpoint to get a sample of result. |
| 70 | + |
| 71 | +Follows an example of Curl call: |
| 72 | + |
| 73 | +``` |
| 74 | +curl --location --request POST 'http://localhost:500/sample' |
| 75 | +``` |
| 76 | + |
| 77 | +# Quickstart |
| 78 | + |
| 79 | +## How to run |
| 80 | + |
| 81 | +## Docker |
| 82 | + |
| 83 | +### Using Dockerfile |
| 84 | + |
| 85 | +Using the command line go in the Database-datasource parent folder\ |
| 86 | +From this folder: |
| 87 | +``` |
| 88 | +cd .. |
| 89 | +``` |
| 90 | + |
| 91 | +Build the Docker file: |
| 92 | +``` |
| 93 | +docker build -t database-parser -f .\connector\Dockerfile . |
| 94 | +``` |
| 95 | + |
| 96 | +**Command parameters: |
| 97 | +- **-t**: Set built image name |
| 98 | +- **-f**: Specify the path to the Dockerfile** |
| 99 | + |
| 100 | +Run the built Docker image: |
| 101 | +``` |
| 102 | +docker run -p 5000:5000 --name database-parser-app Database-parser |
| 103 | +``` |
| 104 | + |
| 105 | +Command parameters: |
| 106 | +- **-p**: Exposed port to make api calls |
| 107 | +- **-name**: Set docker container name |
| 108 | + |
| 109 | +## Kubernetes |
| 110 | + |
| 111 | +#### TO-DO: Add guide |
| 112 | + |
| 113 | +# Docs and resources |
| 114 | + |
| 115 | +#### TO-DO: Add docs |
| 116 | + |
| 117 | +# Migration Guides |
| 118 | + |
| 119 | +#### TO-DO: Add wiki links |
| 120 | + |
| 121 | +# Contributing |
| 122 | + |
| 123 | +#### TO-DO: Add Contributing |
| 124 | + |
| 125 | +# Authors and acknowledgment |
| 126 | + |
| 127 | +#### TO-DO: Add Authors and acknowledgment |
| 128 | + |
| 129 | +# License |
| 130 | + |
| 131 | +#### TO-DO: Add License |
0 commit comments