Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

24 lähtötietoihin valmiiksi hallinnolliset rajat #307

Open
wants to merge 45 commits into
base: main
Choose a base branch
from

Conversation

msorvoja
Copy link
Contributor

@msorvoja msorvoja commented Jun 17, 2024

Fix #24

Still missing tests.

@Rikuoja One test fails since the revision file has been edited by hand. This is because alembic overwrites an optional field containing geometry to nullable=False. That won't do since the code list containing the names of the administrative regions must be loaded into the administrative_region code table before the geometries can be inserted. Hence, the geometry field is momentarily filled with NULL values.

@msorvoja msorvoja requested a review from Rikuoja June 17, 2024 11:19
@msorvoja msorvoja linked an issue Jun 17, 2024 that may be closed by this pull request
Copy link
Contributor

@Rikuoja Rikuoja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just some minor changes!

database/mml_loader/mml_loader.py Show resolved Hide resolved
database/mml_loader/mml_loader.py Outdated Show resolved Hide resolved
database/test/test_services.py Outdated Show resolved Hide resolved
@msorvoja
Copy link
Contributor Author

msorvoja commented Jun 24, 2024

@Rikuoja Declaring geom field as geom = Column(Geometry(geometry_type="MULTIPOLYGON", srid=3067), nullable=True) instead of geom: Mapped[Optional[MultiPolygon]] fixed the problem where alembic forced the field to be non-nullable. A bug in alembic or geoalcemy2?

@msorvoja msorvoja marked this pull request as ready for review June 24, 2024 07:46
Copy link
Contributor

@Rikuoja Rikuoja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One test question.

"SELECT count(*) FROM codes.administrative_region WHERE geom IS NULL"
)
geom_count = cur.fetchone()[0]
assert geom_count == 19
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msorvoja Here I'm wondering about this test, it doesn't seem to work. Here we test that geom is NULL in all the 19 rows, it should be NOT NULL I think?

Also, when running the test, my call responds with

{'statusCode': 200, 'body': '"0 inserted or updated. 0 deleted."'}

so it looks here we are testing that the code does NOT fill any geometries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Lähtötietoihin valmiiksi hallinnolliset rajat.
2 participants