xml2db 0.9.4__tar.gz → 0.10.0__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.
- {xml2db-0.9.4 → xml2db-0.10.0}/LICENSE +18 -18
- {xml2db-0.9.4/src/xml2db.egg-info → xml2db-0.10.0}/PKG-INFO +98 -98
- {xml2db-0.9.4 → xml2db-0.10.0}/README.md +75 -75
- {xml2db-0.9.4 → xml2db-0.10.0}/pyproject.toml +38 -38
- {xml2db-0.9.4 → xml2db-0.10.0}/setup.cfg +4 -4
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/__init__.py +21 -21
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/document.py +671 -653
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/exceptions.py +4 -4
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/model.py +658 -643
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/table/__init__.py +5 -5
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/table/column.py +222 -199
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/table/duplicated_table.py +180 -180
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/table/relations.py +243 -243
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/table/reused_table.py +175 -175
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/table/table.py +356 -356
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/table/transformed_table.py +312 -314
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db/xml_converter.py +268 -268
- {xml2db-0.9.4 → xml2db-0.10.0/src/xml2db.egg-info}/PKG-INFO +98 -98
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db.egg-info/SOURCES.txt +1 -1
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db.egg-info/requires.txt +2 -2
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db.egg-info/top_level.txt +0 -1
- {xml2db-0.9.4 → xml2db-0.10.0}/tests/test_conversions.py +85 -85
- xml2db-0.10.0/tests/test_models_output.py +77 -0
- {xml2db-0.9.4 → xml2db-0.10.0}/tests/test_roundtrip.py +111 -105
- xml2db-0.9.4/src/debug.py +0 -34
- {xml2db-0.9.4 → xml2db-0.10.0}/src/xml2db.egg-info/dependency_links.txt +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
Copyright (c) 2024 Commission de régulation de l'énergie
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
Copyright (c) 2024 Commission de régulation de l'énergie
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
19
|
SOFTWARE.
|
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: xml2db
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Import complex XML files to a relational database
|
|
5
|
-
Author-email: Commission de régulation de l'énergie <opensource@cre.fr>
|
|
6
|
-
Project-URL: Documentation, https://cre-dev.github.io/xml2db
|
|
7
|
-
Project-URL: Repository, https://github.com/cre-dev/xml2db
|
|
8
|
-
Project-URL: Issues page, https://github.com/cre-dev/xml2db/issues
|
|
9
|
-
Classifier: Programming Language :: Python :: 3
|
|
10
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Requires-Python: >=3.9
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
License-File: LICENSE
|
|
15
|
-
Requires-Dist: sqlalchemy>1.4
|
|
16
|
-
Requires-Dist: xmlschema==3.1.0
|
|
17
|
-
Requires-Dist: lxml==5.1.0
|
|
18
|
-
Provides-Extra: docs
|
|
19
|
-
Requires-Dist: mkdocs-material==9.5.
|
|
20
|
-
Requires-Dist: mkdocstrings
|
|
21
|
-
Provides-Extra: tests
|
|
22
|
-
Requires-Dist: pytest>=7.0; extra == "tests"
|
|
23
|
-
|
|
24
|
-
# Xml2db
|
|
25
|
-
|
|
26
|
-
`xml2db` is a Python package which allows loading XML data into a relational database. It is designed to handle complex
|
|
27
|
-
schemas which cannot be easily denormalized to a flat table, without any custom code.
|
|
28
|
-
|
|
29
|
-
It builds a data model (i.e. a set of database tables linked with foreign keys relationships) based on a XSD schema and
|
|
30
|
-
allows parsing and loading XML files into the database, and get them back to XML, if needed.
|
|
31
|
-
|
|
32
|
-
It is as simple as:
|
|
33
|
-
|
|
34
|
-
```python
|
|
35
|
-
from xml2db import DataModel
|
|
36
|
-
|
|
37
|
-
# Create a data model of tables with relations based on the XSD file
|
|
38
|
-
data_model = DataModel(
|
|
39
|
-
xsd_file="path/to/file.xsd",
|
|
40
|
-
connection_string="postgresql+psycopg2://testuser:testuser@localhost:5432/testdb",
|
|
41
|
-
)
|
|
42
|
-
# Parse an XML file based on this XSD
|
|
43
|
-
document = data_model.parse_xml(
|
|
44
|
-
xml_file="path/to/file.xml"
|
|
45
|
-
)
|
|
46
|
-
# Insert the document content into the database
|
|
47
|
-
document.insert_into_target_tables()
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
The data model will adhere closely to the XSD schema, but `xml2db` will perform simplifications aimed at limiting the
|
|
51
|
-
complexity of the resulting data model and the storage footprint.
|
|
52
|
-
|
|
53
|
-
The raw data loaded into the database can then be processed using [DBT](https://www.getdbt.com/), SQL views or
|
|
54
|
-
other tools aimed at extracting, correcting and formatting the data into more user-friendly tables.
|
|
55
|
-
|
|
56
|
-
`xml2db` is developed and used at the [French energy regulation authority (CRE)](https://www.cre.fr/) to process XML
|
|
57
|
-
data.
|
|
58
|
-
|
|
59
|
-
This package uses `sqlalchemy` to interact with the database, so it should work with different database backends.
|
|
60
|
-
|
|
61
|
-
additional packages to connect to your database (e.g. `
|
|
62
|
-
`
|
|
63
|
-
|
|
64
|
-
**Please read the [package documentation website](https://cre-dev.github.io/xml2db) for all the details!**
|
|
65
|
-
|
|
66
|
-
## Installation
|
|
67
|
-
|
|
68
|
-
The package can be installed, preferably in a virtual environment, using `pip`:
|
|
69
|
-
|
|
70
|
-
``` bash
|
|
71
|
-
pip install xml2db
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Testing
|
|
75
|
-
|
|
76
|
-
Running the tests requires installing additional development dependencies, after cloning the repo, with:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
pip install -e .[tests,docs]
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Run all tests with the following command:
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
python -m pytest
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Integration tests require write access to a PostgreSQL or MS SQL Server database; the connection string is provided as an
|
|
89
|
-
environment variable `DB_STRING`. If you want to run only conversion tests that do not require a database you can run:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
pytest -m "not dbtest"
|
|
93
|
-
`````
|
|
94
|
-
|
|
95
|
-
## Contributing
|
|
96
|
-
|
|
97
|
-
Contributions are more than welcome, as well as bug reports, starting with the project's
|
|
98
|
-
[issue page](https://github.com/cre-dev/xml2db/issues).
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: xml2db
|
|
3
|
+
Version: 0.10.0
|
|
4
|
+
Summary: Import complex XML files to a relational database
|
|
5
|
+
Author-email: Commission de régulation de l'énergie <opensource@cre.fr>
|
|
6
|
+
Project-URL: Documentation, https://cre-dev.github.io/xml2db
|
|
7
|
+
Project-URL: Repository, https://github.com/cre-dev/xml2db
|
|
8
|
+
Project-URL: Issues page, https://github.com/cre-dev/xml2db/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: sqlalchemy>1.4
|
|
16
|
+
Requires-Dist: xmlschema==3.1.0
|
|
17
|
+
Requires-Dist: lxml==5.1.0
|
|
18
|
+
Provides-Extra: docs
|
|
19
|
+
Requires-Dist: mkdocs-material==9.5.23; extra == "docs"
|
|
20
|
+
Requires-Dist: mkdocstrings-python==1.10.2; extra == "docs"
|
|
21
|
+
Provides-Extra: tests
|
|
22
|
+
Requires-Dist: pytest>=7.0; extra == "tests"
|
|
23
|
+
|
|
24
|
+
# Xml2db
|
|
25
|
+
|
|
26
|
+
`xml2db` is a Python package which allows loading XML data into a relational database. It is designed to handle complex
|
|
27
|
+
schemas which cannot be easily denormalized to a flat table, without any custom code.
|
|
28
|
+
|
|
29
|
+
It builds a data model (i.e. a set of database tables linked with foreign keys relationships) based on a XSD schema and
|
|
30
|
+
allows parsing and loading XML files into the database, and get them back to XML, if needed.
|
|
31
|
+
|
|
32
|
+
It is as simple as:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from xml2db import DataModel
|
|
36
|
+
|
|
37
|
+
# Create a data model of tables with relations based on the XSD file
|
|
38
|
+
data_model = DataModel(
|
|
39
|
+
xsd_file="path/to/file.xsd",
|
|
40
|
+
connection_string="postgresql+psycopg2://testuser:testuser@localhost:5432/testdb",
|
|
41
|
+
)
|
|
42
|
+
# Parse an XML file based on this XSD
|
|
43
|
+
document = data_model.parse_xml(
|
|
44
|
+
xml_file="path/to/file.xml"
|
|
45
|
+
)
|
|
46
|
+
# Insert the document content into the database
|
|
47
|
+
document.insert_into_target_tables()
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The data model will adhere closely to the XSD schema, but `xml2db` will perform simplifications aimed at limiting the
|
|
51
|
+
complexity of the resulting data model and the storage footprint.
|
|
52
|
+
|
|
53
|
+
The raw data loaded into the database can then be processed using [DBT](https://www.getdbt.com/), SQL views or
|
|
54
|
+
other tools aimed at extracting, correcting and formatting the data into more user-friendly tables.
|
|
55
|
+
|
|
56
|
+
`xml2db` is developed and used at the [French energy regulation authority (CRE)](https://www.cre.fr/) to process XML
|
|
57
|
+
data.
|
|
58
|
+
|
|
59
|
+
This package uses `sqlalchemy` to interact with the database, so it should work with different database backends.
|
|
60
|
+
Automated integration tests run against PostgreSQL, MySQL and MS SQL Server. `xml2db` does not work with SQLite. You may
|
|
61
|
+
have to install additional packages to connect to your database (e.g. `psycopg2` for PostgreSQL, `pymysql` for MySQL or
|
|
62
|
+
`pyodbc` for MS SQL Server).
|
|
63
|
+
|
|
64
|
+
**Please read the [package documentation website](https://cre-dev.github.io/xml2db) for all the details!**
|
|
65
|
+
|
|
66
|
+
## Installation
|
|
67
|
+
|
|
68
|
+
The package can be installed, preferably in a virtual environment, using `pip`:
|
|
69
|
+
|
|
70
|
+
``` bash
|
|
71
|
+
pip install xml2db
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Testing
|
|
75
|
+
|
|
76
|
+
Running the tests requires installing additional development dependencies, after cloning the repo, with:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install -e .[tests,docs]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Run all tests with the following command:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
python -m pytest
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Integration tests require write access to a PostgreSQL or MS SQL Server database; the connection string is provided as an
|
|
89
|
+
environment variable `DB_STRING`. If you want to run only conversion tests that do not require a database you can run:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
pytest -m "not dbtest"
|
|
93
|
+
`````
|
|
94
|
+
|
|
95
|
+
## Contributing
|
|
96
|
+
|
|
97
|
+
Contributions are more than welcome, as well as bug reports, starting with the project's
|
|
98
|
+
[issue page](https://github.com/cre-dev/xml2db/issues).
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
# Xml2db
|
|
2
|
-
|
|
3
|
-
`xml2db` is a Python package which allows loading XML data into a relational database. It is designed to handle complex
|
|
4
|
-
schemas which cannot be easily denormalized to a flat table, without any custom code.
|
|
5
|
-
|
|
6
|
-
It builds a data model (i.e. a set of database tables linked with foreign keys relationships) based on a XSD schema and
|
|
7
|
-
allows parsing and loading XML files into the database, and get them back to XML, if needed.
|
|
8
|
-
|
|
9
|
-
It is as simple as:
|
|
10
|
-
|
|
11
|
-
```python
|
|
12
|
-
from xml2db import DataModel
|
|
13
|
-
|
|
14
|
-
# Create a data model of tables with relations based on the XSD file
|
|
15
|
-
data_model = DataModel(
|
|
16
|
-
xsd_file="path/to/file.xsd",
|
|
17
|
-
connection_string="postgresql+psycopg2://testuser:testuser@localhost:5432/testdb",
|
|
18
|
-
)
|
|
19
|
-
# Parse an XML file based on this XSD
|
|
20
|
-
document = data_model.parse_xml(
|
|
21
|
-
xml_file="path/to/file.xml"
|
|
22
|
-
)
|
|
23
|
-
# Insert the document content into the database
|
|
24
|
-
document.insert_into_target_tables()
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
The data model will adhere closely to the XSD schema, but `xml2db` will perform simplifications aimed at limiting the
|
|
28
|
-
complexity of the resulting data model and the storage footprint.
|
|
29
|
-
|
|
30
|
-
The raw data loaded into the database can then be processed using [DBT](https://www.getdbt.com/), SQL views or
|
|
31
|
-
other tools aimed at extracting, correcting and formatting the data into more user-friendly tables.
|
|
32
|
-
|
|
33
|
-
`xml2db` is developed and used at the [French energy regulation authority (CRE)](https://www.cre.fr/) to process XML
|
|
34
|
-
data.
|
|
35
|
-
|
|
36
|
-
This package uses `sqlalchemy` to interact with the database, so it should work with different database backends.
|
|
37
|
-
|
|
38
|
-
additional packages to connect to your database (e.g. `
|
|
39
|
-
`
|
|
40
|
-
|
|
41
|
-
**Please read the [package documentation website](https://cre-dev.github.io/xml2db) for all the details!**
|
|
42
|
-
|
|
43
|
-
## Installation
|
|
44
|
-
|
|
45
|
-
The package can be installed, preferably in a virtual environment, using `pip`:
|
|
46
|
-
|
|
47
|
-
``` bash
|
|
48
|
-
pip install xml2db
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Testing
|
|
52
|
-
|
|
53
|
-
Running the tests requires installing additional development dependencies, after cloning the repo, with:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
pip install -e .[tests,docs]
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Run all tests with the following command:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
python -m pytest
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Integration tests require write access to a PostgreSQL or MS SQL Server database; the connection string is provided as an
|
|
66
|
-
environment variable `DB_STRING`. If you want to run only conversion tests that do not require a database you can run:
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
pytest -m "not dbtest"
|
|
70
|
-
`````
|
|
71
|
-
|
|
72
|
-
## Contributing
|
|
73
|
-
|
|
74
|
-
Contributions are more than welcome, as well as bug reports, starting with the project's
|
|
75
|
-
[issue page](https://github.com/cre-dev/xml2db/issues).
|
|
1
|
+
# Xml2db
|
|
2
|
+
|
|
3
|
+
`xml2db` is a Python package which allows loading XML data into a relational database. It is designed to handle complex
|
|
4
|
+
schemas which cannot be easily denormalized to a flat table, without any custom code.
|
|
5
|
+
|
|
6
|
+
It builds a data model (i.e. a set of database tables linked with foreign keys relationships) based on a XSD schema and
|
|
7
|
+
allows parsing and loading XML files into the database, and get them back to XML, if needed.
|
|
8
|
+
|
|
9
|
+
It is as simple as:
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from xml2db import DataModel
|
|
13
|
+
|
|
14
|
+
# Create a data model of tables with relations based on the XSD file
|
|
15
|
+
data_model = DataModel(
|
|
16
|
+
xsd_file="path/to/file.xsd",
|
|
17
|
+
connection_string="postgresql+psycopg2://testuser:testuser@localhost:5432/testdb",
|
|
18
|
+
)
|
|
19
|
+
# Parse an XML file based on this XSD
|
|
20
|
+
document = data_model.parse_xml(
|
|
21
|
+
xml_file="path/to/file.xml"
|
|
22
|
+
)
|
|
23
|
+
# Insert the document content into the database
|
|
24
|
+
document.insert_into_target_tables()
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The data model will adhere closely to the XSD schema, but `xml2db` will perform simplifications aimed at limiting the
|
|
28
|
+
complexity of the resulting data model and the storage footprint.
|
|
29
|
+
|
|
30
|
+
The raw data loaded into the database can then be processed using [DBT](https://www.getdbt.com/), SQL views or
|
|
31
|
+
other tools aimed at extracting, correcting and formatting the data into more user-friendly tables.
|
|
32
|
+
|
|
33
|
+
`xml2db` is developed and used at the [French energy regulation authority (CRE)](https://www.cre.fr/) to process XML
|
|
34
|
+
data.
|
|
35
|
+
|
|
36
|
+
This package uses `sqlalchemy` to interact with the database, so it should work with different database backends.
|
|
37
|
+
Automated integration tests run against PostgreSQL, MySQL and MS SQL Server. `xml2db` does not work with SQLite. You may
|
|
38
|
+
have to install additional packages to connect to your database (e.g. `psycopg2` for PostgreSQL, `pymysql` for MySQL or
|
|
39
|
+
`pyodbc` for MS SQL Server).
|
|
40
|
+
|
|
41
|
+
**Please read the [package documentation website](https://cre-dev.github.io/xml2db) for all the details!**
|
|
42
|
+
|
|
43
|
+
## Installation
|
|
44
|
+
|
|
45
|
+
The package can be installed, preferably in a virtual environment, using `pip`:
|
|
46
|
+
|
|
47
|
+
``` bash
|
|
48
|
+
pip install xml2db
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Testing
|
|
52
|
+
|
|
53
|
+
Running the tests requires installing additional development dependencies, after cloning the repo, with:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install -e .[tests,docs]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Run all tests with the following command:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
python -m pytest
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Integration tests require write access to a PostgreSQL or MS SQL Server database; the connection string is provided as an
|
|
66
|
+
environment variable `DB_STRING`. If you want to run only conversion tests that do not require a database you can run:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pytest -m "not dbtest"
|
|
70
|
+
`````
|
|
71
|
+
|
|
72
|
+
## Contributing
|
|
73
|
+
|
|
74
|
+
Contributions are more than welcome, as well as bug reports, starting with the project's
|
|
75
|
+
[issue page](https://github.com/cre-dev/xml2db/issues).
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["setuptools>=61.0"]
|
|
3
|
-
build-backend = "setuptools.build_meta"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "xml2db"
|
|
7
|
-
version = "0.
|
|
8
|
-
authors = [
|
|
9
|
-
{ name="Commission de régulation de l'énergie", email="opensource@cre.fr" },
|
|
10
|
-
]
|
|
11
|
-
description = "Import complex XML files to a relational database"
|
|
12
|
-
readme = "README.md"
|
|
13
|
-
requires-python = ">=3.9"
|
|
14
|
-
classifiers = [
|
|
15
|
-
"Programming Language :: Python :: 3",
|
|
16
|
-
"License :: OSI Approved :: MIT License",
|
|
17
|
-
"Operating System :: OS Independent",
|
|
18
|
-
]
|
|
19
|
-
dependencies = [
|
|
20
|
-
"sqlalchemy>1.4",
|
|
21
|
-
"xmlschema==3.1.0",
|
|
22
|
-
"lxml==5.1.0",
|
|
23
|
-
]
|
|
24
|
-
|
|
25
|
-
[project.optional-dependencies]
|
|
26
|
-
docs = ["mkdocs-material==9.5.
|
|
27
|
-
tests = ["pytest>=7.0"]
|
|
28
|
-
|
|
29
|
-
[project.urls]
|
|
30
|
-
"Documentation" = "https://cre-dev.github.io/xml2db"
|
|
31
|
-
"Repository" = "https://github.com/cre-dev/xml2db"
|
|
32
|
-
"Issues page" = "https://github.com/cre-dev/xml2db/issues"
|
|
33
|
-
|
|
34
|
-
[tool.pytest.ini_options]
|
|
35
|
-
markers = [
|
|
36
|
-
"dbtest: marks tests as integration tests requiring a database backend (deselect with '-m \"not dbtest\"')",
|
|
37
|
-
]
|
|
38
|
-
junit_family = "xunit2"
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "xml2db"
|
|
7
|
+
version = "0.10.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Commission de régulation de l'énergie", email="opensource@cre.fr" },
|
|
10
|
+
]
|
|
11
|
+
description = "Import complex XML files to a relational database"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"sqlalchemy>1.4",
|
|
21
|
+
"xmlschema==3.1.0",
|
|
22
|
+
"lxml==5.1.0",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
docs = ["mkdocs-material==9.5.23", "mkdocstrings-python==1.10.2"]
|
|
27
|
+
tests = ["pytest>=7.0"]
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
"Documentation" = "https://cre-dev.github.io/xml2db"
|
|
31
|
+
"Repository" = "https://github.com/cre-dev/xml2db"
|
|
32
|
+
"Issues page" = "https://github.com/cre-dev/xml2db/issues"
|
|
33
|
+
|
|
34
|
+
[tool.pytest.ini_options]
|
|
35
|
+
markers = [
|
|
36
|
+
"dbtest: marks tests as integration tests requiring a database backend (deselect with '-m \"not dbtest\"')",
|
|
37
|
+
]
|
|
38
|
+
junit_family = "xunit2"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[egg_info]
|
|
2
|
-
tag_build =
|
|
3
|
-
tag_date = 0
|
|
4
|
-
|
|
1
|
+
[egg_info]
|
|
2
|
+
tag_build =
|
|
3
|
+
tag_date = 0
|
|
4
|
+
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
from xml2db.model import DataModel
|
|
2
|
-
from xml2db.document import Document
|
|
3
|
-
from xml2db.table import (
|
|
4
|
-
DataModelTable,
|
|
5
|
-
DataModelTableReused,
|
|
6
|
-
DataModelTableDuplicated,
|
|
7
|
-
DataModelColumn,
|
|
8
|
-
DataModelRelationN,
|
|
9
|
-
DataModelRelation1,
|
|
10
|
-
)
|
|
11
|
-
|
|
12
|
-
__all__ = [
|
|
13
|
-
"DataModel",
|
|
14
|
-
"Document",
|
|
15
|
-
"DataModelTable",
|
|
16
|
-
"DataModelTableReused",
|
|
17
|
-
"DataModelTableDuplicated",
|
|
18
|
-
"DataModelColumn",
|
|
19
|
-
"DataModelRelation1",
|
|
20
|
-
"DataModelRelationN",
|
|
21
|
-
]
|
|
1
|
+
from xml2db.model import DataModel
|
|
2
|
+
from xml2db.document import Document
|
|
3
|
+
from xml2db.table import (
|
|
4
|
+
DataModelTable,
|
|
5
|
+
DataModelTableReused,
|
|
6
|
+
DataModelTableDuplicated,
|
|
7
|
+
DataModelColumn,
|
|
8
|
+
DataModelRelationN,
|
|
9
|
+
DataModelRelation1,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"DataModel",
|
|
14
|
+
"Document",
|
|
15
|
+
"DataModelTable",
|
|
16
|
+
"DataModelTableReused",
|
|
17
|
+
"DataModelTableDuplicated",
|
|
18
|
+
"DataModelColumn",
|
|
19
|
+
"DataModelRelation1",
|
|
20
|
+
"DataModelRelationN",
|
|
21
|
+
]
|