SQL To OData
This Python package provides tools to facilitate adding an OData interface in front of a SQL database. It currently only supports extracting SQLite table schemas and data in their entirety into static files, which can then be hosted on a website or otherwise provided to OData consumers.
It was initially built to create data that can be consumed on Tableau Public.
Prerequisites
Installation is via pip:
pip install sql-to-odata
Usage
Basic usage is as follows:
import sql_to_odata
odata_interface = sql_to_odata.ODataInterface(sqlite_filename='stuff.db')
# Extracts the schema for all tables in XML format
schema_xml = odata_interface.get_database_schema_xml()
# Extracts the data from a single table in JSON format
table_json = odata_interface.get_table_json('people')
# Dumps the schemas and all tables to a folder, with the schema
# file named "$metadata" and data files named after the tables;
# this output format can be directly served on a website
odata_interface.dump_database('/path/to/output')
# Dump only a portion of the tables in the database
odata_interface.dump_database('/path/to/output', tables_to_include=['people', 'places', 'things'])
Run help(sql_to_odata) to get more information on the available functions.
To-Do
- Translate settings for nullable fields, default values, and primary keys
- Create a test database that includes more variety of stuff, esp around datatypes
- Add tests to ensure mapping of dates and times works (esp since OData requires a TZ-aware datetime)
- Add support for more source databases
References
Metadata
Release files for sql-to-odata 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sql_to_odata-0.3.1.tar.gz | 4.7 kB | Without provenance | Details for sql_to_odata-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sql_to_odata-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for sql_to_odata-0.3.1-py3-none-any.whl |
Total release size: 9.9 kB
Release files / sql_to_odata-0.3.1.tar.gz
| Download URL | sql_to_odata-0.3.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ae237d2c8659cb1151340397ba5e48cbd7d4112e36d8e38fa40e980662662d4
|
|
BLAKE2b-256 checksum How to use checksums |
8fa10c22dda25f4c71785fc751503dd2f651c7f6d595b13be56e386740715d59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure
|
Release files / sql_to_odata-0.3.1-py3-none-any.whl
| Download URL | sql_to_odata-0.3.1-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e8ae2fda8b2bd0b0fb9b3eb6ff47c010116e677e8d3c212309578ae65c0eb441
|
|
BLAKE2b-256 checksum How to use checksums |
2c37b0d29ba9d8f2b593e1de002789a1b0710495c234c2c8b655c656fe81693f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure
|
Security for sql-to-odata 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.