Skip to content

Commit 6fe817b

Browse files
committed
Test MariaDB SAV round trips
1 parent 501f178 commit 6fe817b

6 files changed

Lines changed: 43 additions & 15 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,22 @@ jobs:
6060
options: >-
6161
--health-cmd "mysqladmin ping -h localhost -uroot -proot"
6262
--health-interval 10s --health-timeout 5s --health-retries 10
63+
mariadb:
64+
image: mariadb:11.4
65+
ports:
66+
- 3307:3306
67+
env:
68+
MARIADB_DATABASE: openstatspec
69+
MARIADB_USER: openstatspec
70+
MARIADB_PASSWORD: openstatspec
71+
MARIADB_ROOT_PASSWORD: root
72+
options: >-
73+
--health-cmd "mariadb-admin ping -h localhost -uroot -proot"
74+
--health-interval 10s --health-timeout 5s --health-retries 10
6375
env:
6476
OPENSTATSPEC_POSTGRES_URL: postgresql+psycopg://openstatspec:openstatspec@localhost:5432/openstatspec
6577
OPENSTATSPEC_MYSQL_URL: mysql+pymysql://openstatspec:openstatspec@localhost:3306/openstatspec
78+
OPENSTATSPEC_MARIADB_URL: mysql+pymysql://openstatspec:openstatspec@localhost:3307/openstatspec
6679
steps:
6780
- uses: actions/checkout@v7
6881
- uses: actions/setup-python@v7

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ openstatspec export --database-url postgresql+psycopg://... --dataset-id respons
4141

4242
The adapter supports unencrypted SAV and ZSAV import and SAV/ZSAV export for
4343
the semantics exposed by its SPSS engine. SQLite is the local reference path.
44-
PostgreSQL and MySQL/MariaDB are also covered by service-backed CI conformance
45-
checks. Use these explicit SQLAlchemy URLs:
44+
PostgreSQL, MySQL, and MariaDB are each covered by separate service-backed CI
45+
conformance checks. Use these explicit SQLAlchemy URLs:
4646

4747
- SQLite: `sqlite:///dataset.sqlite`
4848
- PostgreSQL: `postgresql+psycopg://user:password@host/database`

‎docs/release-readiness.md‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ validate that representation and export it back to SAV or ZSAV.
1717
| PostgreSQL | `postgresql+psycopg://…` | GitHub Actions PostgreSQL service |
1818
| MySQL/MariaDB | `mysql+pymysql://…` | GitHub Actions MySQL service |
1919

20-
The MySQL service test establishes the shared MySQL/MariaDB profile contract.
21-
It is not a claim that every MariaDB release or configuration has separately
22-
been tested.
20+
Separate MySQL 8.4 and MariaDB 11.4 services test the shared MySQL/MariaDB
21+
profile contract. This does not claim coverage for every server configuration.
2322

2423
## Export-loss policy
2524

@@ -36,8 +35,8 @@ machine-readable loss report with the export result.
3635
## Maintainer checks before tagging
3736

3837
1. Run `python -m pytest`.
39-
2. Run the service-backed profile checks with configured PostgreSQL and MySQL
40-
URLs, or confirm the GitHub Actions SQL-services job is green.
38+
2. Run the service-backed profile checks with configured PostgreSQL, MySQL, and
39+
MariaDB URLs, or confirm the GitHub Actions SQL-services job is green.
4140
3. Build with `python -m build` and install the generated wheel in a clean
4241
environment.
4342
4. Confirm `openstatspec capabilities` reflects the intended support boundary.

‎docs/sav-profile.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ kept as metadata and is restored to SAV on export.
1515

1616
## Verified SQL profiles
1717

18-
SQLite has a local reference fixture. PostgreSQL and MySQL/MariaDB have
19-
service-backed conformance checks in GitHub Actions that import, validate, and
20-
export the same supported fixture. The MySQL service test verifies the shared
21-
MySQL/MariaDB profile contract; it does not claim separately tested coverage
22-
for every MariaDB release or server configuration. An import that exceeds a
18+
SQLite has a local reference fixture. PostgreSQL, MySQL, and MariaDB have
19+
separate service-backed conformance checks in GitHub Actions that import,
20+
validate, and export the same supported fixture. MySQL 8.4 and MariaDB 11.4
21+
exercise the shared profile contract; this does not claim coverage for every
22+
server configuration. An import that exceeds a
2323
target's strict single-table column limit fails before it creates a dataset.
2424

2525
## Explicit current boundaries

‎src/openstatspec/spss/sav.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,19 @@ def export_sav_dataset(*, database_url: str, dataset_id: str, destination: str |
101101
dataset, variables, rows = read_wide_dataset(database_url=database_url, dataset_id=dataset_id)
102102
import pandas as pd
103103
frame = pd.DataFrame(
104-
[{item["source_name"]: row[item["physical_name"]] for item in variables} for row in rows],
104+
[
105+
{
106+
item["source_name"]: (
107+
None
108+
if row[item["physical_name"]] is None
109+
else float(row[item["physical_name"]])
110+
)
111+
if item["storage_kind"] == "numeric"
112+
else row[item["physical_name"]]
113+
for item in variables
114+
}
115+
for row in rows
116+
],
105117
columns=[item["source_name"] for item in variables],
106118
)
107119
labels = {item["source_name"]: item["label"] for item in variables if item["label"]}

‎tests/test_sql_services.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Real-service conformance checks for PostgreSQL and MySQL/MariaDB profiles."""
1+
"""Real-service conformance checks for PostgreSQL, MySQL, and MariaDB profiles."""
22

33
import os
44

@@ -31,7 +31,11 @@ def source_sav(tmp_path):
3131

3232
@pytest.mark.parametrize(
3333
("environment_name", "dataset_id"),
34-
[("OPENSTATSPEC_POSTGRES_URL", "profile_pg"), ("OPENSTATSPEC_MYSQL_URL", "profile_mysql")],
34+
[
35+
("OPENSTATSPEC_POSTGRES_URL", "profile_pg"),
36+
("OPENSTATSPEC_MYSQL_URL", "profile_mysql"),
37+
("OPENSTATSPEC_MARIADB_URL", "profile_mariadb"),
38+
],
3539
)
3640
def test_live_profile_import_validate_and_export(environment_name, dataset_id, source_sav, tmp_path):
3741
database_url = os.environ.get(environment_name)

0 commit comments

Comments
 (0)