mirror of
https://github.com/hansjone/netx.git
synced 2026-10-15 02:33:23 +08:00
Replace pandas with a small openpyxl/csv reader for imports.
pandas + numpy were ~60MB of the shipped venv for three call sites (alarm Excel import, managed-NE import, import template). netx_api/tabular.py reads/writes xlsx and csv and parses spreadsheet timestamps. Checked against the pandas version on the same inputs: timestamp parsing identical for 24 formats, managed-NE csv/xlsx import, stored rows and both templates identical. Differences, all fixes: - alarm codes in mixed text/number columns are "1001", not "1001.0" - error row numbers are the real sheet rows (blank rows no longer shift them) - GBK-encoded CSVs (Chinese Excel "Save as CSV") import instead of failing - "2024年1月2日 03:04:05" style timestamps parse Also: conftest compares parsed DB URLs (newer SQLAlchemy renders "C:" as "C%3A"). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
e2e6c09825
commit
19ab1a64a1
8 changed files with 282 additions and 54 deletions
|
|
@ -15,9 +15,12 @@ os.environ["NETX_CREDENTIAL_SECRET_FILE"] = str(Path(_TEST_STATE.name) / "creden
|
|||
|
||||
|
||||
def pytest_sessionstart(session):
|
||||
from sqlalchemy.engine import make_url
|
||||
|
||||
from netx_api.db import engine
|
||||
|
||||
if str(engine.url) != _TEST_DATABASE_URL:
|
||||
# Compare parsed URLs: newer SQLAlchemy renders "C:" as "C%3A" in str(url).
|
||||
if engine.url != make_url(_TEST_DATABASE_URL):
|
||||
raise pytest.UsageError("NetX tests require the isolated temporary database")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue