{"id":24746480,"url":"https://github.com/yuhexiong/raw-sql-spark-submit-api-python-flask","last_synced_at":"2026-04-11T01:52:11.683Z","repository":{"id":272716673,"uuid":"914731229","full_name":"yuhexiong/raw-sql-spark-submit-api-python-flask","owner":"yuhexiong","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-14T06:20:17.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T07:26:11.783Z","etag":null,"topics":["apache-spark","api","backend","flask","python","spark"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yuhexiong.png","metadata":{"files":{"readme":"README-CH.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-10T07:34:30.000Z","updated_at":"2025-02-14T06:20:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"9bdf9689-91b2-48ae-afd5-3f4961115427","html_url":"https://github.com/yuhexiong/raw-sql-spark-submit-api-python-flask","commit_stats":null,"previous_names":["yuhexiong/raw-sql-spark-submit-api-python-flask"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhexiong%2Fraw-sql-spark-submit-api-python-flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhexiong%2Fraw-sql-spark-submit-api-python-flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhexiong%2Fraw-sql-spark-submit-api-python-flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuhexiong%2Fraw-sql-spark-submit-api-python-flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuhexiong","download_url":"https://codeload.github.com/yuhexiong/raw-sql-spark-submit-api-python-flask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245040189,"owners_count":20551301,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache-spark","api","backend","flask","python","spark"],"created_at":"2025-01-28T04:23:39.870Z","updated_at":"2025-10-11T20:50:33.261Z","avatar_url":"https://github.com/yuhexiong.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raw SQL Spark Submit API\n\n提供 API 到 Hadoop Resource Manager 機器中提交 Raw SQL Data Pipeline 的後端服務。\n\n\n## Overview\n\n- 語言: Python v3.12\n- 網頁框架: Flask v2.2.5\n\n## Introduction\n\n### API Implementation\n- 讀取 Request Body 的參數並進行驗證\n- 連線至 Resource Manager 機器中在 Spark Data Pipeline 的資夾內依照參數 filename 建立 Pipeline Yaml\n- 在當前目錄提交 Data Pipeline Python 檔案與 Yaml 到 Spark 立即執行\n\n\n## Step\n\n1. 自行架設 Hadoop Yarn 以及 Spark\n   \n2. 將 Raw SQL Data Pipeline 的 Python 檔案以及所需 Jar 檔放置於機器當中  \n參考 [Raw SQL Data Pipeline Spark](https://github.com/yuhexiong/raw-sql-data-pipeline-spark-python)  \n\n3. 填寫環境變數  \n    複製 `.env.example` 成 `.env` 並修改連線資訊  \n    ```\n    HOSTNAME=RESOURCE_MANAGER_HOST\n    USERNAME=HADOOP_USERNAME\n    PASSWORD=HADOOP_PASSWORD\n    SPARK_HOME=SPARK_HOME\n    SPARK_PIPELINE_DIR=SPARK_PIPELINE_DIR\n    JARS=JARS\n    PYTHON_FILE=mysql_raw_query.py\n    ```\n\n4. 啟動後端服務  \n    ```bash\n    python main.py\n    ```\n    後端服務運行於 `localhost:5000`  \n\n5. 使用 API 提交 Data Pipeline  \n    `POST /api/query`\n    ```json\n    {\n        \"filename\": \"example\",\n        \"source\": {\n            \"host\": \"localhost\",\n            \"port\": 9030,\n            \"database\": \"db\",\n            \"user\": \"user\",\n            \"password\": \"pass\"\n        },\n        \"sink\": {\n            \"host\": \"localhost\",\n            \"port\": 9030,\n            \"database\": \"db\",\n            \"user\": \"user\",\n            \"password\": \"pass\",\n            \"table\": \"table\"\n        },\n        \"query\": \"SELECT * FROM table\"\n    }\n    ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuhexiong%2Fraw-sql-spark-submit-api-python-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuhexiong%2Fraw-sql-spark-submit-api-python-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuhexiong%2Fraw-sql-spark-submit-api-python-flask/lists"}