Skip to content

Repository files navigation

German census data, now in PostgreSQL!

Test Documentation Package version

A CLI program that imports German census CSV data (spelled "zensus" in German) into PostgreSQL with PostGIS geographic data types. All data is provided by the Statitisches Bundesamt of Germany. Currently, only data from the 2022 census is available.

If you want to download the raw data yourself or see the website it comes from, check out the link below:

Installing

To install this program, run:

pip install zensus2pgsql

Using

To get started using this tool, you'll first want to see what datasets are availble:

zensus2pgsql list

For now, the names of the data sets are only available in German, so please use translation software if you need help figuring out what they mean!

After you've fond a dataset to import, you can do so by running the following command:

zensus2pgsql create \
  --host localhost \
  --port 5432 \
  --user username \
  --schema public \
  heizungsart eigentuemerquote

The above command will import two dataset related to the type of heating a house uses and the percentage of those who own their home in a particular area.

Development

This project uses pixi for environment and dependency management. All pixi configuration lives in pyproject.toml.

To get started, install pixi, then install the dev environment and pre-commit hooks:

pixi install -e dev
pixi run -e dev pre-commit install --install-hooks

Run the CLI during development with:

pixi run zensus2pgsql --help

Lint the codebase (runs pre-commit on all files):

pixi run -e dev lint

Run the test suite with coverage:

pixi run -e dev test

The test suite can also be run against a specific supported Python version (3.10-3.14) using the matching environment:

pixi run -e py312 test

Build the documentation locally:

pixi run -e docs docs-serve

Contributing

Contributions are welcome and can ake the following forms:

  • Creating a bug report if you've found an issue
  • Creating a feature request if you'd like to see new functionality added
  • Creating a pull request to accomplish either of the two above
  • Leaving a star on the repository

Before creating a pull request, I kindly ask that you either create a bug report or a feature request first, so I can sign off on having it added to the project.

About

A CLI program for importing geographic German census data into PostgreSQL

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages