From 3339a057697645b3568fb2c75a6af8cca47bb14f Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 20:12:05 +0000 Subject: [PATCH 01/14] updating tests to support all db types --- .github/workflows/testing.yml | 97 +- coverage.xml | 3078 ++++++++--------- .../database_config.py | 27 + report.xml | 2 +- 4 files changed, 1637 insertions(+), 1567 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 2775f0cd..41b2eaa2 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -6,49 +6,92 @@ on: jobs: build: - env: - USING_COVERAGE: "3.12" - DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres" runs-on: ubuntu-latest + strategy: + max-parallel: 10 + matrix: + os: [ubuntu-latest, windows-latest] + python-version: ["3.13","3.12","3.11","3.10","3.9"] + db: [sqlite, postgres, mysql, mssql, oracle] services: - postgresdbTest: + postgres: + if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres - POSTGRES_DB: postgres + POSTGRES_DB: test ports: - 5432:5432 - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - strategy: - max-parallel: 10 - matrix: - os: [ubuntu-latest, windows-latest] - python-version: ["3.13","3.12","3.11", "3.10", "3.9"] + options: >- + --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + mysql: + if: matrix.db == 'mysql' + image: mysql:8 + env: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: test + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 + mssql: + if: matrix.db == 'mssql' + image: mcr.microsoft.com/mssql/server:2019-latest + env: + SA_PASSWORD: "Your_password123" + ACCEPT_EULA: "Y" + ports: + - 1433:1433 + options: >- + --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 + oracle: + if: matrix.db == 'oracle' + image: wnameless/oracle-xe-11g:latest + ports: + - 1521:1521 + env: + ORACLE_ALLOW_REMOTE: "true" + options: >- + --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s system/oracle@localhost:1521/XE" + --health-interval 10s --health-timeout 5s --health-retries 10 + env: + SQLITE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" + POSTGRES_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" + MYSQL_URL: "mysql+aiomysql://root:root@localhost:3306/test" + MSSQL_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" + ORACLE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" + steps: - uses: actions/checkout@v4 - - name: Wait for PostgreSQL to become ready + - name: Wait for database + if: matrix.db != 'sqlite' run: | for i in {1..30}; do - pg_isready -h localhost -p 5432 && echo Success && exit 0 - echo -n . - sleep 2 + case "${{ matrix.db }}" in + postgres) pg_isready -h localhost -p 5432 && break;; + mysql) mysqladmin ping -h localhost -u root -proot && break;; + mssql) /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q "SELECT 1" && break;; + oracle) echo "SELECT 1 FROM DUAL;" | sqlplus -s system/oracle@localhost:1521/XE && break;; + esac + echo -n .; sleep 2 done - echo Failed waiting for Postgres && exit 1 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Clear pip cache - run: pip cache purge - - name: Install dependencies - run: pip install --no-cache-dir -r requirements.txt - # - name: Install dependencies - # run: | - # python -m pip install --upgrade pip - # pip install -r requirements.txt --use-deprecated=legacy-resolver - - name: Test with pytest run: | - pip install pytest - pytest + pip install --no-cache-dir -r requirements.txt + pip install pytest aiomysql pyodbc asyncpg oracledb + - name: Export DATABASE_URL + run: | + case ${{ matrix.db }} in + sqlite) echo "DATABASE_URL=$SQLITE_URL" >> $GITHUB_ENV;; + postgres) echo "DATABASE_URL=$POSTGRES_URL" >> $GITHUB_ENV;; + mysql) echo "DATABASE_URL=$MYSQL_URL" >> $GITHUB_ENV;; + mssql) echo "DATABASE_URL=$MSSQL_URL" >> $GITHUB_ENV;; + oracle) echo "DATABASE_URL=$ORACLE_URL" >> $GITHUB_ENV;; + esac + - name: Test with pytest + run: pytest -q diff --git a/coverage.xml b/coverage.xml index 5ef22829..79dfb10d 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,5 +1,5 @@ - + @@ -25,7 +25,7 @@ - + @@ -57,7 +57,7 @@ - + @@ -68,15 +68,15 @@ - - + + - - - - - - + + + + + + @@ -123,7 +123,7 @@ - + @@ -134,27 +134,27 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + @@ -169,22 +169,22 @@ - - - - - - - - - + + + + + + + + + - - + + @@ -193,264 +193,264 @@ - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - + @@ -461,43 +461,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -516,7 +516,7 @@ - + @@ -530,184 +530,184 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + @@ -719,65 +719,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -787,7 +787,7 @@ - + @@ -799,50 +799,50 @@ - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - + @@ -856,68 +856,68 @@ - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - + @@ -929,7 +929,7 @@ - + @@ -939,22 +939,22 @@ - - - - - - - - - - - - + + + + + + + + + + + + - + @@ -962,8 +962,8 @@ - - + + @@ -979,7 +979,7 @@ - + @@ -1001,33 +1001,33 @@ - - + + - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -1639,7 +1639,7 @@ - + @@ -1701,117 +1701,117 @@ - + - - - - - - - - - + + + + + + + + + - + - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - - - + + + - - - - + + + + - - - - + + + + - - + + - - - + + + - - + + - - - + + + - + @@ -1820,22 +1820,22 @@ - - - + + + - - + + - - - + + + - + @@ -1843,40 +1843,40 @@ - - + + - - + + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - + - + @@ -1885,38 +1885,38 @@ - - - - + + + + - - + + - - - - + + + + - - + + - - - - + + + + - - - + + + - + @@ -1924,21 +1924,21 @@ - - - - + + + + - - - - - + + + + + - + @@ -1948,58 +1948,58 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - + + + - - - + + + - - - + + + - + @@ -2009,44 +2009,44 @@ - - - + + + - + - - - - - - - - + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - + @@ -2056,24 +2056,24 @@ - - + + - + - - + + - - + + - - + + - + @@ -2087,45 +2087,45 @@ - - + + - - - + + + - - - - - + + + + + - + - - - - - - - + + + + + + + - - - + + + - - - + + + - - - + + + - + @@ -2134,54 +2134,54 @@ - - - + + + - - + + - - - + + + - - + + - - + + - - - + + + - - - + + + - - - - + + + + - - - - - - - + + + + + + + - + @@ -2189,28 +2189,28 @@ - - - + + + - - - - + + + + - - + + - - - + + + - - - + + + - + @@ -2220,43 +2220,43 @@ - - - + + + - + - - - - - - - + + + + + + + - - - - + + + + - - - - + + + + - + - + @@ -2270,79 +2270,79 @@ - - - - - - - - - + + + + + + + + + - + - - - - + + + + - - - - - + + + + + - - - - + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - + - + @@ -2355,24 +2355,24 @@ - - - - - + + + + + - + - - - - + + + + - - + + - + @@ -2384,51 +2384,51 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - + + + - + - - - - - + + + + + - - - - - - + + + + + + - - - - + + + + - + @@ -2439,26 +2439,26 @@ - - + + - + - - - + + + - - - + + + - - - - + + + + - + @@ -2471,34 +2471,34 @@ - - - + + + - + - - + + - - + + - - - - - + + + + + - + - + @@ -2521,493 +2521,493 @@ - - + + - - - + + + - - - + + + - - - - - - - - + + + + + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - - - - - - - + + + + + + + + - - + + - - - + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - + + + + - - - - + + + + - - - - - + + + + + - - - + + + - - - + + + - - - + + + - - - - + + + + - - - + + + - - - + + + - - - - - + + + + + - - - - - - - + + + + + + + - - + + - - - - + + + + - - - + + + - - - + + + - - - - + + + + - - + + - - - + + + - - - + + + - - + + - - + + - - + + - - - - - - - + + + + + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - - - + + + - - + + - - - - - - + + + + + + - + @@ -3023,31 +3023,31 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + @@ -3055,34 +3055,34 @@ - - - - + + + + - - - + + + - - - - + + + + - - - + + + - + - + @@ -3094,45 +3094,45 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + - + - - - + + + - - - + + + - - - + + + - - - + + + - + @@ -3146,27 +3146,27 @@ - - - + + + - - - - + + + + - - - - - - - + + + + + + + - - - + + + diff --git a/dsg_lib/async_database_functions/database_config.py b/dsg_lib/async_database_functions/database_config.py index 3eacf072..670db051 100644 --- a/dsg_lib/async_database_functions/database_config.py +++ b/dsg_lib/async_database_functions/database_config.py @@ -131,6 +131,33 @@ class DBConfig: "pool_recycle", "pool_timeout", }, + "mysql": { # experimental + "echo", + "future", + "pool_pre_ping", + "pool_size", + "max_overflow", + "pool_recycle", + "pool_timeout", + }, + "mssql": { # experimental + "echo", + "future", + "pool_pre_ping", + "pool_size", + "max_overflow", + "pool_recycle", + "pool_timeout", + }, + "oracle": { # experimental + "echo", + "future", + "pool_pre_ping", + "pool_size", + "max_overflow", + "pool_recycle", + "pool_timeout", + }, # Add other engines here... } diff --git a/report.xml b/report.xml index 505cf43f..4aa511b8 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + From 701229483ac27aaa8d48f82275d618c53ff650af Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 20:15:31 +0000 Subject: [PATCH 02/14] fixing setup --- .github/workflows/testing.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 41b2eaa2..d3784f93 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,7 +15,6 @@ jobs: db: [sqlite, postgres, mysql, mssql, oracle] services: postgres: - if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres @@ -26,7 +25,6 @@ jobs: options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 mysql: - if: matrix.db == 'mysql' image: mysql:8 env: MYSQL_ROOT_PASSWORD: root @@ -36,7 +34,6 @@ jobs: options: >- --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 mssql: - if: matrix.db == 'mssql' image: mcr.microsoft.com/mssql/server:2019-latest env: SA_PASSWORD: "Your_password123" @@ -46,7 +43,6 @@ jobs: options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 oracle: - if: matrix.db == 'oracle' image: wnameless/oracle-xe-11g:latest ports: - 1521:1521 From 0821c5ee2da4dfa7f9c7e45b07299398e4ef1322 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 20:45:23 +0000 Subject: [PATCH 03/14] updating docker file --- .devcontainer/docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 119ae183..c5411e59 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,3 +1,4 @@ +# .devcontainer docker-compose configuration version: '3.8' services: From 014f96354af42629603d97ca82fb8a1ea27ddd76 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:39:39 +0000 Subject: [PATCH 04/14] run of local docs --- CHANGELOG.md | 19 +++++++++++++++++++ docs/release-notes.md | 19 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f78c94c..028ed468 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## Latest Changes +### Improving SQLAlchemy Queries and Improved Documentation ([v2025.4.17.1](https://github.com/devsetgo/devsetgo_lib/releases/tag/v2025.4.17.1)) + +![DSG Logo](https://raw.githubusercontent.com/devsetgo/devsetgo_lib/refs/heads/main/images/devsetgo_lib_logo_white_bg.svg) +Read the Full Documentation [here](https://devsetgo.github.io/devsetgo_lib/). +#### What's Changed +* fixing sonar issue (#494) @devsetgo +* updating release drafter (#493) @devsetgo +* Improving Examples (#492) @devsetgo +* Fix of issue with distinct queries in read queries (#491) @devsetgo +* updating footer (#490) @devsetgo +* adding raw link to release drafter (#489) @devsetgo +* Improving documentation (#488) @devsetgo +* adding 3.13 testing (#486) @devsetgo + +Built to help reduce copy/paste from multiple projects and uses calendar versioning (year.month.day.build) from [BumpCalver](https://github.com/devsetgo/bumpcalver). + + +Published Date: 2025 April 17, 15:47 + ### New Functions and Updated Documentation ([v2025.4.5.1](https://github.com/devsetgo/devsetgo_lib/releases/tag/v2025.4.5.1)) #### What's Changed diff --git a/docs/release-notes.md b/docs/release-notes.md index 5f78c94c..028ed468 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## Latest Changes +### Improving SQLAlchemy Queries and Improved Documentation ([v2025.4.17.1](https://github.com/devsetgo/devsetgo_lib/releases/tag/v2025.4.17.1)) + +![DSG Logo](https://raw.githubusercontent.com/devsetgo/devsetgo_lib/refs/heads/main/images/devsetgo_lib_logo_white_bg.svg) +Read the Full Documentation [here](https://devsetgo.github.io/devsetgo_lib/). +#### What's Changed +* fixing sonar issue (#494) @devsetgo +* updating release drafter (#493) @devsetgo +* Improving Examples (#492) @devsetgo +* Fix of issue with distinct queries in read queries (#491) @devsetgo +* updating footer (#490) @devsetgo +* adding raw link to release drafter (#489) @devsetgo +* Improving documentation (#488) @devsetgo +* adding 3.13 testing (#486) @devsetgo + +Built to help reduce copy/paste from multiple projects and uses calendar versioning (year.month.day.build) from [BumpCalver](https://github.com/devsetgo/bumpcalver). + + +Published Date: 2025 April 17, 15:47 + ### New Functions and Updated Documentation ([v2025.4.5.1](https://github.com/devsetgo/devsetgo_lib/releases/tag/v2025.4.5.1)) #### What's Changed From 5db2d0ac1808c0113bf6e84e41bb59aa419ea2ca Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:40:05 +0000 Subject: [PATCH 05/14] updating database config documentation and configuration --- docs/database/database_configuration.md | 11 +++++++++++ .../async_database_functions/database_config.py | 15 ++++++++++++--- pyproject.toml | 4 +++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/docs/database/database_configuration.md b/docs/database/database_configuration.md index a673860f..14831850 100644 --- a/docs/database/database_configuration.md +++ b/docs/database/database_configuration.md @@ -1,4 +1,15 @@ # Reference +## Supported Databases + +| Database | Library (with link) | Supported Database Versions (via library) | +|---------------|-------------------------------------------------------------------------------------|-----------------------------------------------| +| PostgreSQL | [asyncpg](https://pypi.org/project/asyncpg/) `>=0.21.0`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99` | asyncpg supports PostgreSQL 9.2+ | +| SQLite | [aiosqlite](https://pypi.org/project/aiosqlite/) `>=0.17.0`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99` | SQLite 3.x | +| Oracle | [oracledb](https://pypi.org/project/oracledb/) `>=2.4.1,<2.5.0`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99` | Oracle Database 11.2+ | +| MS SQL Server | [aioodbc](https://pypi.org/project/aioodbc/) `>=0.4.1`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99` | SQL Server 2008+ (via ODBC driver) | +| CockroachDB | [sqlalchemy-cockroachdb](https://pypi.org/project/sqlalchemy-cockroachdb/) `<2.0.2`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99`
[asyncpg](https://pypi.org/project/asyncpg/) `>=0.21.0` | CockroachDB v19.2+ | +| MySQL | [asyncmy](https://pypi.org/project/asyncmy/) `>=0.2.10`
[SQLAlchemy](https://pypi.org/project/SQLAlchemy/) `>=2.0.10,<2.0.99` | MySQL 5.7+, MariaDB 10.2+ | + ::: dsg_lib.async_database_functions.database_config handler: python diff --git a/dsg_lib/async_database_functions/database_config.py b/dsg_lib/async_database_functions/database_config.py index 670db051..c919dadd 100644 --- a/dsg_lib/async_database_functions/database_config.py +++ b/dsg_lib/async_database_functions/database_config.py @@ -131,7 +131,7 @@ class DBConfig: "pool_recycle", "pool_timeout", }, - "mysql": { # experimental + "cockroachdb": { # experimental support for CockroachDB "echo", "future", "pool_pre_ping", @@ -140,7 +140,7 @@ class DBConfig: "pool_recycle", "pool_timeout", }, - "mssql": { # experimental + "mysql": { # experimental support for MySQL "echo", "future", "pool_pre_ping", @@ -149,7 +149,16 @@ class DBConfig: "pool_recycle", "pool_timeout", }, - "oracle": { # experimental + "mssql": { # experimental support for Microsoft SQL Server + "echo", + "future", + "pool_pre_ping", + "pool_size", + "max_overflow", + "pool_recycle", + "pool_timeout", + }, + "oracle": { # experimental support for Oracle "echo", "future", "pool_pre_ping", diff --git a/pyproject.toml b/pyproject.toml index 544fb97f..85dc0bef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,8 +32,10 @@ postgres = [ "asyncpg>=0.21.0", "sqlalchemy>=2.0.10,<2.0.99",] sqlite = [ "aiosqlite>=0.17.0", "sqlalchemy>=2.0.10,<2.0.99",] oracle = [ "oracledb>=2.4.1,<2.5.0", "sqlalchemy>=2.0.10,<2.0.99",] mssql = [ "aioodbc>=0.4.1", "sqlalchemy>=2.0.10,<2.0.99",] +cockroachdb = [ "sqlalchemy-cockroachdb<2.0.2", "sqlalchemy>=2.0.10,<2.0.99", "asyncpg>=0.21.0",] +mysql = [ "asyncmy>=0.2.10", "sqlalchemy>=2.0.10,<2.0.99",] fastapi = [ "fastapi>=0.100.0", "pydantic[email]>=2.0",] -all = [ "asyncpg>=0.21.0", "sqlalchemy>=2.0.10,<2.0.99", "aiosqlite>=0.17.0", "oracledb>=2.4.1,<2.5.0", "fastapi>=0.100.0", "pydantic[email]>=2.0", "aioodbc>=0.4.1",] +all = [ "asyncpg>=0.21.0", "sqlalchemy>=2.0.10,<2.0.99", "aiosqlite>=0.17.0", "oracledb>=2.4.1,<2.5.0", "fastapi>=0.100.0", "pydantic[email]>=2.0", "aioodbc>=0.4.1", "sqlalchemy-cockroachdb<2.0.0", "asyncmy>=0.2.10",] [project.scripts] From 918e9e81db68b08df5fc6d6d0060ea32d3e97140 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:40:17 +0000 Subject: [PATCH 06/14] formatting --- coverage.xml | 38 +++++++++++++++++++------------------- report.xml | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/coverage.xml b/coverage.xml index 79dfb10d..2ec5a7e8 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,5 +1,5 @@ - + @@ -134,24 +134,24 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/report.xml b/report.xml index 4aa511b8..8b25e30c 100644 --- a/report.xml +++ b/report.xml @@ -1 +1 @@ - + From dccc360183155428b6573c21a4b01dc83e5c9ca9 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:43:11 +0000 Subject: [PATCH 07/14] changing oracle db image --- .github/workflows/testing.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index d3784f93..41459093 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -43,13 +43,13 @@ jobs: options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 oracle: - image: wnameless/oracle-xe-11g:latest + image: container-registry.oracle.com/database/free:latest ports: - 1521:1521 env: - ORACLE_ALLOW_REMOTE: "true" + ORACLE_PWD: "oracle" options: >- - --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s system/oracle@localhost:1521/XE" + --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s sys/oracle@localhost:1521/FREE as sysdba" --health-interval 10s --health-timeout 5s --health-retries 10 env: SQLITE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" From 6dba631358c183ca2e5f666d0b2d28c60ba3c5b8 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:49:33 +0000 Subject: [PATCH 08/14] working on db test setup --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 41459093..769fc9e0 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -8,7 +8,7 @@ jobs: build: runs-on: ubuntu-latest strategy: - max-parallel: 10 + max-parallel: 2 matrix: os: [ubuntu-latest, windows-latest] python-version: ["3.13","3.12","3.11","3.10","3.9"] From 4037578b6808949d8e21e8d6ad075f267d7d5343 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 21:54:35 +0000 Subject: [PATCH 09/14] working mssql to get it working --- .github/workflows/testing.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 769fc9e0..2ec856ad 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,6 +15,7 @@ jobs: db: [sqlite, postgres, mysql, mssql, oracle] services: postgres: + if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres @@ -25,6 +26,7 @@ jobs: options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 mysql: + if: matrix.db == 'mysql' image: mysql:8 env: MYSQL_ROOT_PASSWORD: root @@ -34,6 +36,7 @@ jobs: options: >- --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 mssql: + if: matrix.db == 'mssql' image: mcr.microsoft.com/mssql/server:2019-latest env: SA_PASSWORD: "Your_password123" @@ -43,6 +46,7 @@ jobs: options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 oracle: + if: matrix.db == 'oracle' image: container-registry.oracle.com/database/free:latest ports: - 1521:1521 From 25b7289d20a0ea61916060a946240f870a0b2148 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 22:00:03 +0000 Subject: [PATCH 10/14] working on issue for running db tests --- .github/workflows/testing.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 2ec856ad..769fc9e0 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,7 +15,6 @@ jobs: db: [sqlite, postgres, mysql, mssql, oracle] services: postgres: - if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres @@ -26,7 +25,6 @@ jobs: options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 mysql: - if: matrix.db == 'mysql' image: mysql:8 env: MYSQL_ROOT_PASSWORD: root @@ -36,7 +34,6 @@ jobs: options: >- --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 mssql: - if: matrix.db == 'mssql' image: mcr.microsoft.com/mssql/server:2019-latest env: SA_PASSWORD: "Your_password123" @@ -46,7 +43,6 @@ jobs: options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 oracle: - if: matrix.db == 'oracle' image: container-registry.oracle.com/database/free:latest ports: - 1521:1521 From 17a12037230affcf4fabdea10b89d2c3d75b4e32 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 22:05:58 +0000 Subject: [PATCH 11/14] working on issues with testing the matrix --- .github/workflows/testing.yml | 96 +++++++++++++++++++++++++++++++---- 1 file changed, 87 insertions(+), 9 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 769fc9e0..75b52d4d 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -10,11 +10,92 @@ jobs: strategy: max-parallel: 2 matrix: - os: [ubuntu-latest, windows-latest] - python-version: ["3.13","3.12","3.11","3.10","3.9"] - db: [sqlite, postgres, mysql, mssql, oracle] + include: + - os: ubuntu-latest + python-version: "3.13" + db: sqlite + - os: ubuntu-latest + python-version: "3.13" + db: postgres + - os: ubuntu-latest + python-version: "3.13" + db: mysql + - os: ubuntu-latest + python-version: "3.13" + db: mssql + - os: ubuntu-latest + python-version: "3.13" + db: oracle + - os: ubuntu-latest + python-version: "3.12" + db: sqlite + - os: ubuntu-latest + python-version: "3.12" + db: postgres + - os: ubuntu-latest + python-version: "3.12" + db: mysql + - os: ubuntu-latest + python-version: "3.12" + db: mssql + - os: ubuntu-latest + python-version: "3.12" + db: oracle + - os: ubuntu-latest + python-version: "3.11" + db: sqlite + - os: ubuntu-latest + python-version: "3.11" + db: postgres + - os: ubuntu-latest + python-version: "3.11" + db: mysql + - os: ubuntu-latest + python-version: "3.11" + db: mssql + - os: ubuntu-latest + python-version: "3.11" + db: oracle + - os: ubuntu-latest + python-version: "3.10" + db: sqlite + - os: ubuntu-latest + python-version: "3.10" + db: postgres + - os: ubuntu-latest + python-version: "3.10" + db: mysql + - os: ubuntu-latest + python-version: "3.10" + db: mssql + - os: ubuntu-latest + python-version: "3.10" + db: oracle + - os: ubuntu-latest + python-version: "3.9" + db: sqlite + - os: ubuntu-latest + python-version: "3.9" + db: postgres + - os: ubuntu-latest + python-version: "3.9" + db: mysql + - os: ubuntu-latest + python-version: "3.9" + db: mssql + - os: ubuntu-latest + python-version: "3.9" + db: oracle + env: + SQLITE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" + POSTGRES_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" + MYSQL_URL: "mysql+aiomysql://root:root@localhost:3306/test" + MSSQL_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" + ORACLE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" + services: postgres: + if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres @@ -25,6 +106,7 @@ jobs: options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 mysql: + if: matrix.db == 'mysql' image: mysql:8 env: MYSQL_ROOT_PASSWORD: root @@ -34,6 +116,7 @@ jobs: options: >- --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 mssql: + if: matrix.db == 'mssql' image: mcr.microsoft.com/mssql/server:2019-latest env: SA_PASSWORD: "Your_password123" @@ -43,6 +126,7 @@ jobs: options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 oracle: + if: matrix.db == 'oracle' image: container-registry.oracle.com/database/free:latest ports: - 1521:1521 @@ -51,12 +135,6 @@ jobs: options: >- --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s sys/oracle@localhost:1521/FREE as sysdba" --health-interval 10s --health-timeout 5s --health-retries 10 - env: - SQLITE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" - POSTGRES_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" - MYSQL_URL: "mysql+aiomysql://root:root@localhost:3306/test" - MSSQL_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" - ORACLE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" steps: - uses: actions/checkout@v4 From 01d694aee9fc918680987a100fff617f07f76594 Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 22:08:06 +0000 Subject: [PATCH 12/14] working on test setup --- .github/workflows/testing.yml | 208 +++++++++++++++++----------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 75b52d4d..10556ebe 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -5,97 +5,33 @@ on: workflow_dispatch: jobs: - build: + test-sqlite: runs-on: ubuntu-latest strategy: - max-parallel: 2 matrix: - include: - - os: ubuntu-latest - python-version: "3.13" - db: sqlite - - os: ubuntu-latest - python-version: "3.13" - db: postgres - - os: ubuntu-latest - python-version: "3.13" - db: mysql - - os: ubuntu-latest - python-version: "3.13" - db: mssql - - os: ubuntu-latest - python-version: "3.13" - db: oracle - - os: ubuntu-latest - python-version: "3.12" - db: sqlite - - os: ubuntu-latest - python-version: "3.12" - db: postgres - - os: ubuntu-latest - python-version: "3.12" - db: mysql - - os: ubuntu-latest - python-version: "3.12" - db: mssql - - os: ubuntu-latest - python-version: "3.12" - db: oracle - - os: ubuntu-latest - python-version: "3.11" - db: sqlite - - os: ubuntu-latest - python-version: "3.11" - db: postgres - - os: ubuntu-latest - python-version: "3.11" - db: mysql - - os: ubuntu-latest - python-version: "3.11" - db: mssql - - os: ubuntu-latest - python-version: "3.11" - db: oracle - - os: ubuntu-latest - python-version: "3.10" - db: sqlite - - os: ubuntu-latest - python-version: "3.10" - db: postgres - - os: ubuntu-latest - python-version: "3.10" - db: mysql - - os: ubuntu-latest - python-version: "3.10" - db: mssql - - os: ubuntu-latest - python-version: "3.10" - db: oracle - - os: ubuntu-latest - python-version: "3.9" - db: sqlite - - os: ubuntu-latest - python-version: "3.9" - db: postgres - - os: ubuntu-latest - python-version: "3.9" - db: mysql - - os: ubuntu-latest - python-version: "3.9" - db: mssql - - os: ubuntu-latest - python-version: "3.9" - db: oracle + python-version: ["3.13","3.12","3.11","3.10","3.9"] env: - SQLITE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" - POSTGRES_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" - MYSQL_URL: "mysql+aiomysql://root:root@localhost:3306/test" - MSSQL_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" - ORACLE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" + DATABASE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install --no-cache-dir -r requirements.txt + pip install pytest aiomysql pyodbc asyncpg oracledb + - name: Test with pytest + run: pytest -q + test-postgres: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.13","3.12","3.11","3.10","3.9"] services: postgres: - if: matrix.db == 'postgres' image: postgres:latest env: POSTGRES_USER: postgres @@ -105,8 +41,34 @@ jobs: - 5432:5432 options: >- --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + env: + DATABASE_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" + steps: + - uses: actions/checkout@v4 + - name: Wait for database + run: | + for i in {1..30}; do + pg_isready -h localhost -p 5432 && break + echo -n .; sleep 2 + done + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install --no-cache-dir -r requirements.txt + pip install pytest aiomysql pyodbc asyncpg oracledb + - name: Test with pytest + run: pytest -q + + test-mysql: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.13","3.12","3.11","3.10","3.9"] + services: mysql: - if: matrix.db == 'mysql' image: mysql:8 env: MYSQL_ROOT_PASSWORD: root @@ -115,8 +77,34 @@ jobs: - 3306:3306 options: >- --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 + env: + DATABASE_URL: "mysql+aiomysql://root:root@localhost:3306/test" + steps: + - uses: actions/checkout@v4 + - name: Wait for database + run: | + for i in {1..30}; do + mysqladmin ping -h localhost -u root -proot && break + echo -n .; sleep 2 + done + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install --no-cache-dir -r requirements.txt + pip install pytest aiomysql pyodbc asyncpg oracledb + - name: Test with pytest + run: pytest -q + + test-mssql: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.13","3.12","3.11","3.10","3.9"] + services: mssql: - if: matrix.db == 'mssql' image: mcr.microsoft.com/mssql/server:2019-latest env: SA_PASSWORD: "Your_password123" @@ -125,8 +113,34 @@ jobs: - 1433:1433 options: >- --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 + env: + DATABASE_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" + steps: + - uses: actions/checkout@v4 + - name: Wait for database + run: | + for i in {1..30}; do + /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q "SELECT 1" && break + echo -n .; sleep 2 + done + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + pip install --no-cache-dir -r requirements.txt + pip install pytest aiomysql pyodbc asyncpg oracledb + - name: Test with pytest + run: pytest -q + + test-oracle: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.13","3.12","3.11","3.10","3.9"] + services: oracle: - if: matrix.db == 'oracle' image: container-registry.oracle.com/database/free:latest ports: - 1521:1521 @@ -135,19 +149,14 @@ jobs: options: >- --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s sys/oracle@localhost:1521/FREE as sysdba" --health-interval 10s --health-timeout 5s --health-retries 10 - + env: + DATABASE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" steps: - uses: actions/checkout@v4 - name: Wait for database - if: matrix.db != 'sqlite' run: | for i in {1..30}; do - case "${{ matrix.db }}" in - postgres) pg_isready -h localhost -p 5432 && break;; - mysql) mysqladmin ping -h localhost -u root -proot && break;; - mssql) /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q "SELECT 1" && break;; - oracle) echo "SELECT 1 FROM DUAL;" | sqlplus -s system/oracle@localhost:1521/XE && break;; - esac + echo "SELECT 1 FROM DUAL;" | sqlplus -s system/oracle@localhost:1521/XE && break echo -n .; sleep 2 done - name: Set up Python ${{ matrix.python-version }} @@ -158,14 +167,5 @@ jobs: run: | pip install --no-cache-dir -r requirements.txt pip install pytest aiomysql pyodbc asyncpg oracledb - - name: Export DATABASE_URL - run: | - case ${{ matrix.db }} in - sqlite) echo "DATABASE_URL=$SQLITE_URL" >> $GITHUB_ENV;; - postgres) echo "DATABASE_URL=$POSTGRES_URL" >> $GITHUB_ENV;; - mysql) echo "DATABASE_URL=$MYSQL_URL" >> $GITHUB_ENV;; - mssql) echo "DATABASE_URL=$MSSQL_URL" >> $GITHUB_ENV;; - oracle) echo "DATABASE_URL=$ORACLE_URL" >> $GITHUB_ENV;; - esac - name: Test with pytest run: pytest -q From cdb00d3a6f97e12a078969da331982ff2afe632c Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 22:22:33 +0000 Subject: [PATCH 13/14] reverting back --- .github/workflows/testing.yml | 163 +++++----------------------------- 1 file changed, 23 insertions(+), 140 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 10556ebe..2775f0cd 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -5,167 +5,50 @@ on: workflow_dispatch: jobs: - test-sqlite: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.13","3.12","3.11","3.10","3.9"] + build: env: - DATABASE_URL: "sqlite+aiosqlite:///:memory:?cache=shared" - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install --no-cache-dir -r requirements.txt - pip install pytest aiomysql pyodbc asyncpg oracledb - - name: Test with pytest - run: pytest -q - - test-postgres: + USING_COVERAGE: "3.12" + DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres" runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.13","3.12","3.11","3.10","3.9"] services: - postgres: + postgresdbTest: image: postgres:latest env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres - POSTGRES_DB: test + POSTGRES_DB: postgres ports: - 5432:5432 - options: >- - --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - env: - DATABASE_URL: "postgresql+asyncpg://postgres:postgres@localhost:5432/test" - steps: - - uses: actions/checkout@v4 - - name: Wait for database - run: | - for i in {1..30}; do - pg_isready -h localhost -p 5432 && break - echo -n .; sleep 2 - done - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install --no-cache-dir -r requirements.txt - pip install pytest aiomysql pyodbc asyncpg oracledb - - name: Test with pytest - run: pytest -q - - test-mysql: - runs-on: ubuntu-latest + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 strategy: + max-parallel: 10 matrix: - python-version: ["3.13","3.12","3.11","3.10","3.9"] - services: - mysql: - image: mysql:8 - env: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: test - ports: - - 3306:3306 - options: >- - --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=5 - env: - DATABASE_URL: "mysql+aiomysql://root:root@localhost:3306/test" + os: [ubuntu-latest, windows-latest] + python-version: ["3.13","3.12","3.11", "3.10", "3.9"] steps: - uses: actions/checkout@v4 - - name: Wait for database + - name: Wait for PostgreSQL to become ready run: | for i in {1..30}; do - mysqladmin ping -h localhost -u root -proot && break - echo -n .; sleep 2 + pg_isready -h localhost -p 5432 && echo Success && exit 0 + echo -n . + sleep 2 done + echo Failed waiting for Postgres && exit 1 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install --no-cache-dir -r requirements.txt - pip install pytest aiomysql pyodbc asyncpg oracledb - - name: Test with pytest - run: pytest -q + - name: Clear pip cache + run: pip cache purge - test-mssql: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.13","3.12","3.11","3.10","3.9"] - services: - mssql: - image: mcr.microsoft.com/mssql/server:2019-latest - env: - SA_PASSWORD: "Your_password123" - ACCEPT_EULA: "Y" - ports: - - 1433:1433 - options: >- - --health-cmd "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q \"SELECT 1\"" --health-interval 10s --health-timeout 5s --health-retries 5 - env: - DATABASE_URL: "mssql+pyodbc://sa:Your_password123@localhost:1433/test?driver=ODBC+Driver+17+for+SQL+Server" - steps: - - uses: actions/checkout@v4 - - name: Wait for database - run: | - for i in {1..30}; do - /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P Your_password123 -Q "SELECT 1" && break - echo -n .; sleep 2 - done - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - name: Install dependencies - run: | - pip install --no-cache-dir -r requirements.txt - pip install pytest aiomysql pyodbc asyncpg oracledb + run: pip install --no-cache-dir -r requirements.txt + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # pip install -r requirements.txt --use-deprecated=legacy-resolver - name: Test with pytest - run: pytest -q - - test-oracle: - runs-on: ubuntu-latest - strategy: - matrix: - python-version: ["3.13","3.12","3.11","3.10","3.9"] - services: - oracle: - image: container-registry.oracle.com/database/free:latest - ports: - - 1521:1521 - env: - ORACLE_PWD: "oracle" - options: >- - --health-cmd "echo 'SELECT 1 FROM DUAL;' | sqlplus -s sys/oracle@localhost:1521/FREE as sysdba" - --health-interval 10s --health-timeout 5s --health-retries 10 - env: - DATABASE_URL: "oracle+oracledb://system:oracle@localhost:1521/XE" - steps: - - uses: actions/checkout@v4 - - name: Wait for database run: | - for i in {1..30}; do - echo "SELECT 1 FROM DUAL;" | sqlplus -s system/oracle@localhost:1521/XE && break - echo -n .; sleep 2 - done - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - pip install --no-cache-dir -r requirements.txt - pip install pytest aiomysql pyodbc asyncpg oracledb - - name: Test with pytest - run: pytest -q + pip install pytest + pytest From 10fe5faef25e52b5f5ce94061c57e251d25ee7ab Mon Sep 17 00:00:00 2001 From: devsetgo Date: Thu, 17 Apr 2025 22:29:32 +0000 Subject: [PATCH 14/14] moving test --- .../test_file_functions}/test_file_functions.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/{ => test_common_functions/test_file_functions}/test_file_functions.py (100%) diff --git a/tests/test_file_functions.py b/tests/test_common_functions/test_file_functions/test_file_functions.py similarity index 100% rename from tests/test_file_functions.py rename to tests/test_common_functions/test_file_functions/test_file_functions.py