omop-lite 0.0.17__tar.gz → 0.0.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {omop_lite-0.0.17 → omop_lite-0.0.18}/PKG-INFO +1 -1
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/db/sqlserver.py +9 -4
- {omop_lite-0.0.17 → omop_lite-0.0.18}/pyproject.toml +1 -1
- {omop_lite-0.0.17 → omop_lite-0.0.18}/.gitignore +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/LICENSE +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/README.md +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/__init__.py +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/db/__init__.py +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/db/base.py +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/db/postgres.py +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/scripts/fts.sql +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/scripts/mssql/constraints.sql +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/scripts/mssql/ddl.sql +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/scripts/mssql/indices.sql +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/scripts/mssql/primary_keys.sql +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/scripts/pg/constraints.sql +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/scripts/pg/ddl.sql +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/scripts/pg/fts_index.sql +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/scripts/pg/indices.sql +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/scripts/pg/primary_keys.sql +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/settings.py +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/CDM_SOURCE.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/CONCEPT.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/CONCEPT_ANCESTOR.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/CONCEPT_CLASS.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/CONCEPT_RELATIONSHIP.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/CONCEPT_SYNONYM.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/CONDITION_OCCURRENCE.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/DOMAIN.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/DRUG_STRENGTH.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/MEASUREMENT.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/OBSERVATION.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/PERSON.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/RELATIONSHIP.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/100/VOCABULARY.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/1000/CONCEPT.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/1000/CONDITION_ERA.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/1000/CONDITION_OCCURRENCE.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/1000/DRUG_ERA.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/1000/DRUG_EXPOSURE.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/1000/MEASUREMENT.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/1000/OBSERVATION.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/1000/OBSERVATION_PERIOD.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/1000/PERSON.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/1000/PROCEDURE_OCCURRENCE.csv +0 -0
- {omop_lite-0.0.17 → omop_lite-0.0.18}/omop_lite/synthetic/1000/VISIT_OCCURRENCE.csv +0 -0
@@ -37,7 +37,7 @@ class SQLServerDatabase(Database):
|
|
37
37
|
with open(str(file_path), "r", encoding="utf-8", newline="") as f:
|
38
38
|
reader = csv.reader(f, delimiter=delimiter)
|
39
39
|
headers = next(reader)
|
40
|
-
|
40
|
+
|
41
41
|
columns = ", ".join(f"[{col}]" for col in headers)
|
42
42
|
placeholders = ", ".join(["?" for _ in headers])
|
43
43
|
insert_sql = f"INSERT INTO {settings.schema_name}.[{table_name}] ({columns}) VALUES ({placeholders})"
|
@@ -46,9 +46,14 @@ class SQLServerDatabase(Database):
|
|
46
46
|
try:
|
47
47
|
cursor = conn.cursor()
|
48
48
|
for line_no, row in enumerate(reader, start=2):
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
# Pad short rows
|
50
|
+
if len(row) < len(headers):
|
51
|
+
row += [None] * (len(headers) - len(row))
|
52
|
+
logger.info(f"Row {line_no} padded: {row}")
|
53
|
+
elif len(row) > len(headers):
|
54
|
+
logger.info(f"Row {line_no} trimmed: too many values ({len(row)}), expected {len(headers)} – trimming.")
|
55
|
+
row = row[:len(headers)]
|
56
|
+
|
52
57
|
cursor.execute(insert_sql, row)
|
53
58
|
conn.commit()
|
54
59
|
finally:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|