{"id":20555841,"url":"https://github.com/mintimate/chinesecalendarsqlmaker","last_synced_at":"2025-03-06T06:41:36.284Z","repository":{"id":251753332,"uuid":"838333941","full_name":"Mintimate/ChineseCalendarSqlMaker","owner":"Mintimate","description":"用于根据中国的节假日日历自动生成Oracle工作日历的SQL插入语句和CSV数据文件。需要使用最新的chinesecalendar库","archived":false,"fork":false,"pushed_at":"2024-08-05T12:54:46.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T18:03:11.385Z","etag":null,"topics":["chinese-calendar","sql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mintimate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-08-05T12:35:07.000Z","updated_at":"2024-08-05T12:54:50.000Z","dependencies_parsed_at":"2024-08-05T14:58:33.803Z","dependency_job_id":null,"html_url":"https://github.com/Mintimate/ChineseCalendarSqlMaker","commit_stats":null,"previous_names":["mintimate/chinesecalendarsqlmaker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintimate%2FChineseCalendarSqlMaker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintimate%2FChineseCalendarSqlMaker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintimate%2FChineseCalendarSqlMaker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mintimate%2FChineseCalendarSqlMaker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mintimate","download_url":"https://codeload.github.com/Mintimate/ChineseCalendarSqlMaker/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242163849,"owners_count":20082224,"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":["chinese-calendar","sql"],"created_at":"2024-11-16T03:21:06.945Z","updated_at":"2025-03-06T06:41:36.260Z","avatar_url":"https://github.com/Mintimate.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 中国农历假期生成\n\n使用场景： 根据中国的节假日表，自动生成Oracle工作日历插入报表。\n\n操作：\n- 因为需要同步最新的法定节假日库，所以需要移动`main.py`内部代码到公网环境。\n- 更新`chinese_calendar`依赖库（使用`pip install -U chinesecalendar`命令进行更新。\n- 填充`main.py`头部的参数地址并运行`main.py`即可生成Oracle的insert脚本。\n\n## 示例运行\n执行该脚本后，将在指定路径下生成 `.sql` 和 `.csv` 文件，分别包含 SQL 语句和数据统计表格。\n\n## 配置\n- `TARGET_TABLE`: 目标数据库表名。\n- `TARGET_YEAR`: 生成数据的目标年份。\n- `TARGET_SAVE_PATH`: 生成文件的保存路径。\n\n## 执行流程\n1. 创建必要的文件夹结构。\n2. 获取目标年份的所有日期。\n3. 对每个日期执行判断，并根据结果生成相应的 SQL 语句。\n4. 将 SQL 语句写入文件，并将 DataFrame 数据输出为 CSV 文件。\n\nMermaid流程图：\n```mermaid\ngraph TD;\n    A[开始] --\u003e B{配置参数};\n    B --\u003e|加载配置| C[创建文件夹];\n    C --\u003e D{获取全年日期};\n    D --\u003e E[遍历每个日期];\n    E --\u003e F{判断日期类型};\n    F --\u003e|普通工作日| G[记录日期类型];\n    F --\u003e|普通周末| H[记录日期类型];\n    F --\u003e|节日假期| I[记录日期类型及备注];\n    F --\u003e|节日补班| J[记录日期类型及备注];\n    G --\u003e K[生成SQL语句];\n    H --\u003e K;\n    I --\u003e K;\n    J --\u003e K;\n    K --\u003e L{保存至文件};\n    L --\u003e|保存SQL文件| M[完成];\n    L --\u003e|保存CSV文件| M;\n    M --\u003e N[结束];\n\n    classDef startEnd fill:#f9d6c1,stroke:#333,stroke-width:4px;\n    classDef config fill:#e5f5f5,stroke:#333,stroke-width:4px;\n    classDef loop fill:#fff2cc,stroke:#333,stroke-width:4px;\n    classDef process fill:#e2f5f5,stroke:#333,stroke-width:4px;\n    classDef save fill:#f5f5e2,stroke:#333,stroke-width:4px;\n\n    class A startEnd;\n    class B config;\n    class E,D loop;\n    class G,H,I,J,K process;\n    class L save;\n```\n\n\n## 注意\n需要注意：由于次年的节假日安排，取决于国务院发布的日程。 一般是每年的`11月前后`发布新版本`chinesecalendar`。\n\n如：2023年的数据，需要在2022年11月以后才可获取到。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmintimate%2Fchinesecalendarsqlmaker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmintimate%2Fchinesecalendarsqlmaker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmintimate%2Fchinesecalendarsqlmaker/lists"}