Tools to facilitate adding an OData interface in front of a SQL database.
Project description
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
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sql_to_odata-0.3.1.tar.gz.
File metadata
- Download URL: sql_to_odata-0.3.1.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ae237d2c8659cb1151340397ba5e48cbd7d4112e36d8e38fa40e980662662d4
|
|
| MD5 |
ff74d693738c9675c87087ac78eb08a6
|
|
| BLAKE2b-256 |
8fa10c22dda25f4c71785fc751503dd2f651c7f6d595b13be56e386740715d59
|
File details
Details for the file sql_to_odata-0.3.1-py3-none-any.whl.
File metadata
- Download URL: sql_to_odata-0.3.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8ae2fda8b2bd0b0fb9b3eb6ff47c010116e677e8d3c212309578ae65c0eb441
|
|
| MD5 |
37c39a4627c892941e2a1ef5d2e53330
|
|
| BLAKE2b-256 |
2c37b0d29ba9d8f2b593e1de002789a1b0710495c234c2c8b655c656fe81693f
|