Skip to main content

ODPS Python SDK

Project description

Elegent way to access ODPS API.

Dependencies

  • Python (=2.7.x)

  • setuptools (>=3.0)

  • requests (>=2.1.0)

  • enum34 (>=1.0.4)

  • six (>=1.10.0)

  • protobuf (>=2.5.0)

Installation

The quick way:

pip install pyodps

Or from source code:

$ virtualenv pyodps_env
$ source pyodps_env/bin/activate
$ git clone ...
$ cd pyodps
$ python setup.py install

Run Unittest

  • copy conf/test.conf.template to odps/test/test.conf, and fill it with your account

  • run python -m unittest discover

Usage

>>> from odps import ODPS
>>> o = ODPS('**your-access-id**', '**your-secret-access-key**',
...          project='**your-project**', endpoint='**your-end-point**')
>>> dual = o.get_table('dual')
>>> dual.name
'dual'
>>> dual.creation_time
datetime.datetime(2014, 6, 6, 13, 28, 24)
>>> dual.is_virtual_view
False
>>> dual.size
448
>>> dual.columns
[{u'comment': u'', u'type': u'string', u'name': u'id', u'label': u''}]

Python UDF Debugging Tool

#file: plus.py
from odps.udf import annotate

@annotate('bigint,bigint->bigint')
class Plus(object):
    def evaluate(self, a, b):
        return a + b
$ cat plus.input
1,1
3,2
$ pyou plus.Plus < plus.input
2
5

License

Licensed under the Apache License 2.0

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

pyodps-0.2.0.tar.gz (68.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page