Skip to main content

python-odata

A simple library for read/write access to OData services.

  • Supports OData version 4.0
  • Requires JSON format support from the service
  • Should work on both Python 2.x and 3.x

Documentation

Available on readthedocs.org

Dependencies

  • requests >= 2.0
  • python-dateutil
  • rich >= 13.3.1

Demo

Reading data from the Northwind service.

from odata import ODataService
url = 'http://services.odata.org/V4/Northwind/Northwind.svc/'
Service = ODataService(url, reflect_entities=True)
Supplier = Service.entities['Supplier']

query = Service.query(Supplier)
query = query.limit(2)
query = query.order_by(Supplier.CompanyName.asc())

for supplier in query:
    print('Company:', supplier.CompanyName)

    for product in supplier.Products:
        print('- Product:', product.ProductName)

Writing changes. Note that the real Northwind service is read-only and the data modifications do not work against it.

import datetime

Order = Service.entities['Order']
Employee = Service.entities['Employee']

empl = Service.query(Employee).first()

query = Service.query(Order)
query = query.filter(Order.ShipCity == 'Berlin')

for order in query:
    order.ShippedDate = datetime.datetime.utcnow() 
    order.Employee = empl
    Service.save(order)

Release files for python-odata 0.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-odata 0.5.4
File Size Uploaded
python_odata-0.5.4.tar.gz 28.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-odata 0.5.4
File Interpreter ABI Platform
python_odata-0.5.4-py3-none-any.whl Python 3 none any Details

Total release size: 63.6 kB

Release files / python_odata-0.5.4.tar.gz

Download URL python_odata-0.5.4.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
97746fcc334634b551b7845f13173ca4b007b68061e8235c9373c7f8de74d7eb
BLAKE2b-256 checksum
How to use checksums
d849f0d423e660098c803d45bba9db512902f2958141bbbbecb14f94aa1ae5a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.11.1 Windows/10

Release files / python_odata-0.5.4-py3-none-any.whl

Download URL python_odata-0.5.4-py3-none-any.whl
Size 34.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
82b97d46f8cca1b5ca6843e754924b89c8673fd07fb21cf070488655b1645cb3
BLAKE2b-256 checksum
How to use checksums
3c4bcc488a97d447fea39d420597a7458aefe313c5a4191edc9c328e33697cdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.1 CPython/3.11.1 Windows/10

Release history Release notifications | RSS feed

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.8

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.5

2 release files

This release

0.5.4 This release

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page