database of nyc housing data
Project description
# NYCDB
a tool for building a database of NYC housing data
This is a Python library and cli tool for installing, updating and managing NYCDB, a postgres database of NYC Housing Data.
For more background information on this project and links to download copies of full database dump visit: https://github.com/nycdb/nycdb. We use the term nycdb to refer to both the python software and the running copy of the postgres database.
## Using the cli tool
You will need python 3.6+ and Postgres. The latest version can be installed from pypi with pip: ` python3 -m pip install nycdb `
If the installation is successful, you can view a summary of the tool’s options by running nycdb –help
To print a list of datasets: ` nycdb –list-datasets`
nycdb’s main job is to download datasets and import them into postgres. It does not manage the database for you. You can use the flags -U/–user, -D/–database, -P/–password, and -H/–host to instruct nycdb to connect to the correct database. See nycdb –help for the defaults.
Example: downloading, loading, and verifying the dataset hpd_violations:
` sh nycdb --download hpd_violations nycdb --load hpd_violations nycdb --verify hpd_violations `
You can also verify all datasets: ` nycdb –verify-all `
By default the downloaded data files are is stored in ./data. Use –root-dir to change the location of the data directory.
You can export a .sql file for any dataset by using the –dump command
## Development
There are two development workflows: one using python virtual environments and one using docker.
### python3 virtual environments
First check your python version to make sure you have 3.6 or higher: python3 –version
Setup the virtual environment and install the requirements: make init
Install nycdb into the virtual environment: ` make install`
Run the tests: make test
Run only the unit tests: make test-unit
### Using docker
This reuqires docker and docker-compose.
To get started run ` docker-compose up `
After Docker downloads and builds some things, it will start a Postgres server on port 7777 of your local machine, which you can connect to via a desktop client if you like. You can also press <kbd>CTRL</kbd>-<kbd>C</kbd> at any point to stop the server.
In a separate terminal, you can run:
` docker-compose run app bash `
At this point you are inside a bash shell in a container that has everything already set up for you. The initial working directory will be /nycdb, which is mapped to the root of the project’s repository. From here you can run nycdb to access the command-line tool.
To develop on nycdb itself:
You can run pytest to run the test suite.
Any changes you make to the tool’s source code will automatically be reflected in future invocations of nycdb and/or the test suite.
If you don’t have a desktop Postgres client, you can always run nycdb –dbshell to interactively inspect the database with [psql][].
You can leave the bash shell with exit.
If you ever want to wipe the database, run docker-compose down -v.
[install Docker]: https://www.docker.com/get-started [psql]: http://postgresguide.com/utilities/psql.html
### Adding New Datasets
See the [guide Here](ADDING_NEW_DATASETS.md) for the steps to add a new dataset
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nycdb-0.1.27.tar.gz
.
File metadata
- Download URL: nycdb-0.1.27.tar.gz
- Upload date:
- Size: 17.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3727072e252aee9f6830d02f99221c3888e1b6d3b55f9c0fb7b86743a573a9e4 |
|
MD5 | 2f95c72534c6a90a329d27de8ce13922 |
|
BLAKE2b-256 | 3519c19a846b151232b7d8df93f08cc105c2da5a68950e4d84552f19621133ff |
File details
Details for the file nycdb-0.1.27-py3-none-any.whl
.
File metadata
- Download URL: nycdb-0.1.27-py3-none-any.whl
- Upload date:
- Size: 49.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 214766f81361c9811ffca309395ae707e85d28a2aad9b3265d71b24beeb4ffdb |
|
MD5 | 044c298d211127f7d132743d5b21dd55 |
|
BLAKE2b-256 | cd41b5d59ac3ea2aca875ca196cb45a7a15d5556099968099e1979ec300874b0 |