Socrata数据集的SQL加载器
项目描述
🏛️ socrata2sql

许多州和地方政府使用Socrata来运行他们的开放数据门户。此工具允许您从一个这样的门户中抓取数据集并将其复制到您选择的SQL数据库中。它使用Socrata API来理解数据集中的列,并尝试在SQL数据库中创建正确类型化的列以匹配,包括如果数据库和源数据集支持的话,PostGIS几何形状。
需求
- Python 3.x
安装
$ pipenv install socrata2sql
或
$ pip install socrata2sql
使用
Socrata to SQL database loader
Load a dataset from a Socrata-powered open data portal into a SQL database.
Uses the Socrata API to inspect the dataset, then sets up a table with matching
SQL types and loads all rows. The loader supports any database supported by
SQLalchemy.
Usage:
socrata2sql insert <site> <dataset_id> [-d=<database_url>] [-a=<app_token>] [-t=<table_name>]
socrata2sql ls <site> [-a=<app_token>]
socrata2sql (-h | --help)
socrata2sql (-v | --version)
Options:
<site> The domain for the open data site. Ex: www.dallasopendata.com
<dataset_id> The ID of the dataset on the open data site. This is usually
a few characters, separated by a hyphen, at the end of the
URL. Ex: 64pp-jeba
-d=<database_url> Database connection string for destination database as
dialect+driver://username:password@host:port/database.
Default: sqlite:///<dataset name>.sqlite
-t=<table_name> Destiation table in the database. Defaults to a sanitized
version of the dataset's name on Socrata.
-a=<app_token> App token for the site. Only necessary for high-volume
requests. Default: None
-h --help Show this screen.
-v --version Show version.
Examples:
List all datasets on the Dallas open data portal:
$ socrata2sql ls www.dallasopendata.com
Load the Dallas check register into a local SQLite file (file name chosen
from the dataset name):
$ socrata2sql insert www.dallasopendata.com 64pp-jeba
Load it into a PostgreSQL database called mydb:
$ socrata2sql insert www.dallasopendata.com 64pp-jeba -d=postgresql:///mydb
本地开发
目前测试非常有限。可以使用以下命令运行:
$ python setup.py tests
版权
© 2019 The Dallas Morning News
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源分发
socrata2sql-0.1.4.tar.gz (6.0 kB 查看哈希值)
构建分发
socrata2sql-0.1.4-py3-none-any.whl (8.4 kB 查看哈希值)
关闭
socrata2sql-0.1.4.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | e58536fc91004694d41203bf4412d4205fc822c18cf06cd5d51af0096e97ad77 |
|
MD5 | 51662bb2d729b9dc2aca424c933b919a |
|
BLAKE2b-256 | 223ddac86bf74761a2d3674952355d81aa8ed90f89b442054881881f2d288941 |
关闭
socrata2sql-0.1.4-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 710b1bce42140b903cd5669560f71e8378b1cc4acd54798dfc6311bb3c9a1c17 |
|
MD5 | 0510d61818b996ced977c54df3d7ad79 |
|
BLAKE2b-256 | 69ca8f9f7816bf71607002288412ffc14851b21fa74c4aa0783eb40384aad20e |