ODPS Python SDK and data analysis framework
Project description
Elegent way to access ODPS API. Documentation
Installation
The quick way:
pip install pyodps[full]
If you don’t need to use Jupyter, just type
pip install pyodps
The dependencies will be installed automatically.
Or from source code:
$ virtualenv pyodps_env
$ source pyodps_env/bin/activate
$ pip install git+https://github.com/aliyun/aliyun-odps-python-sdk.git
Dependencies
Python (>=2.7), including Python 3+, pypy, Python 3.7 recommended
setuptools (>=3.0)
Run Tests
install pytest
copy conf/test.conf.template to odps/tests/test.conf, and fill it with your account
run pytest odps
Usage
>>> import os
>>> from odps import ODPS
>>> # Make sure environment variable ALIBABA_CLOUD_ACCESS_KEY_ID already set to Access Key ID of user
>>> # while environment variable ALIBABA_CLOUD_ACCESS_KEY_SECRET set to Access Key Secret of user.
>>> # Not recommended to hardcode Access Key ID or Access Key Secret in your code.
>>> o = ODPS(
>>> os.getenv('ALIBABA_CLOUD_ACCESS_KEY_ID'),
>>> os.getenv('ALIBABA_CLOUD_ACCESS_KEY_SECRET'),
>>> project='**your-project**',
>>> endpoint='**your-endpoint**',
>>> )
>>> dual = o.get_table('dual')
>>> dual.name
'dual'
>>> dual.table_schema
odps.Schema {
c_int_a bigint
c_int_b bigint
c_double_a double
c_double_b double
c_string_a string
c_string_b string
c_bool_a boolean
c_bool_b boolean
c_datetime_a datetime
c_datetime_b datetime
}
>>> dual.creation_time
datetime.datetime(2014, 6, 6, 13, 28, 24)
>>> dual.is_virtual_view
False
>>> dual.size
448
>>> dual.table_schema.columns
[<column c_int_a, type bigint>,
<column c_int_b, type bigint>,
<column c_double_a, type double>,
<column c_double_b, type double>,
<column c_string_a, type string>,
<column c_string_b, type string>,
<column c_bool_a, type boolean>,
<column c_bool_b, type boolean>,
<column c_datetime_a, type datetime>,
<column c_datetime_b, type datetime>]
DataFrame API
>>> from odps.df import DataFrame
>>> df = DataFrame(o.get_table('pyodps_iris'))
>>> df.dtypes
odps.Schema {
sepallength float64
sepalwidth float64
petallength float64
petalwidth float64
name string
}
>>> df.head(5)
|==========================================| 1 / 1 (100.00%) 0s
sepallength sepalwidth petallength petalwidth name
0 5.1 3.5 1.4 0.2 Iris-setosa
1 4.9 3.0 1.4 0.2 Iris-setosa
2 4.7 3.2 1.3 0.2 Iris-setosa
3 4.6 3.1 1.5 0.2 Iris-setosa
4 5.0 3.6 1.4 0.2 Iris-setosa
>>> df[df.sepalwidth > 3]['name', 'sepalwidth'].head(5)
|==========================================| 1 / 1 (100.00%) 12s
name sepalwidth
0 Iris-setosa 3.5
1 Iris-setosa 3.2
2 Iris-setosa 3.1
3 Iris-setosa 3.6
4 Iris-setosa 3.9
Command-line and IPython enhancement
In [1]: %load_ext odps In [2]: %enter Out[2]: <odps.inter.Room at 0x10fe0e450> In [3]: %sql select * from pyodps_iris limit 5 |==========================================| 1 / 1 (100.00%) 2s Out[3]: sepallength sepalwidth petallength petalwidth name 0 5.1 3.5 1.4 0.2 Iris-setosa 1 4.9 3.0 1.4 0.2 Iris-setosa 2 4.7 3.2 1.3 0.2 Iris-setosa 3 4.6 3.1 1.5 0.2 Iris-setosa 4 5.0 3.6 1.4 0.2 Iris-setosa
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
Contributing
For a development install, clone the repository and then install from source:
git clone https://github.com/aliyun/aliyun-odps-python-sdk.git cd pyodps pip install -r requirements.txt -e .
If you need to modify the frontend code, you need to install nodejs/npm. To build and install your frontend code, use
python setup.py build_js python setup.py install_js
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
Built Distributions
Hashes for pyodps-0.11.5b1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 581ad19521bb553876744ebd57e1e5f06174aeeb45a13b4d357ab759072eee2d |
|
MD5 | 57b26e88fa9360a9a35937072912cece |
|
BLAKE2b-256 | c1fa2f4f4544e8dbf7c94cb7243d9e1f6bda8dde4899907762c1951613af0bb6 |
Hashes for pyodps-0.11.5b1-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f165a1d738315cd79d69afc4d8f7efce27c0203e384fe6ef38ff2f9c9b5113e3 |
|
MD5 | 56c6a5b7c75cfc2357c73fd1cb293c9a |
|
BLAKE2b-256 | 7b8db6dcf672ac556a61e28fa08944ac6109eddfed9d07301ba1f8df47574349 |
Hashes for pyodps-0.11.5b1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dc46657847926deff64889a599494b56225569287f06b2deb35df2258622ef5d |
|
MD5 | 4189d5614f9203e4fc476cb202a01f60 |
|
BLAKE2b-256 | 986aeb707f8acf577fcfb40be1338bf12c34d11218c43b339357a1b33ed566bf |
Hashes for pyodps-0.11.5b1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee3f12aa80e24cb6cccb7df4cba96fbfa978e031cfc8e75bd7ca1b4cf0661460 |
|
MD5 | 18dff59704b4c47dd760bcee006518d7 |
|
BLAKE2b-256 | 684e3c12327780e5cf40a5cfbba85594f0726b55cfc668634e44aed828ef5fe1 |
Hashes for pyodps-0.11.5b1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 409d40764dde5732c9fb4a7a1f61a69a944e42861ce8123627f2ecdbc9cff276 |
|
MD5 | 8c28c6c6508c99dd4e8ad3e81bca1747 |
|
BLAKE2b-256 | 2a429dde312256dbd5ebfaa4898a5299d60d712c0878daba8a98619d03786958 |
Hashes for pyodps-0.11.5b1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4672bc34a85df8dbbb4d529ac881a6eb8ba618a8d353e6be792e077f2d50e68 |
|
MD5 | 9235bf0666d548dc259d88f0d67c7a7c |
|
BLAKE2b-256 | 5fe5ff7c2d0cdabbbbaf0061088c59fee9a354c880a8186dd0982235e7d7f4ba |
Hashes for pyodps-0.11.5b1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 161b00d5818736d0419eca0d29a288afc11b4184ee5e07a418d63032ac8a40cf |
|
MD5 | 26b4f611f8bbc42abc8cbfd9e60c6913 |
|
BLAKE2b-256 | f12583fff2d487a72874eacfe0077e8450a0b89f7cade0952042663dc3dc5b38 |
Hashes for pyodps-0.11.5b1-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ecec736307e1d107aff8d7165d296eb0e85857ad418df1cf5dcd8d2b374ffb6 |
|
MD5 | 327d70b500d5ea212f136070f2a8f208 |
|
BLAKE2b-256 | 2aae209b685a024d7815f0805385f35ebe0ee0f3c3e455b5c365b82396a2ea37 |
Hashes for pyodps-0.11.5b1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47b3c7893c22dc2de7e1988524d6f95a7674a0fba120f6f78c3de0a8b5dc442d |
|
MD5 | 9221e2cd4c0ac918d730e2280c0e004d |
|
BLAKE2b-256 | 36a14bf7f979adc2f311841772ba7f0e23ec1d5ebf16971a2d8452358498c204 |
Hashes for pyodps-0.11.5b1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35fdc0b6a46ba259932ffa3e239f36e8753d4c5777f35cbfa6caac4072883849 |
|
MD5 | d1e7ebd8bbf592bdd26d342e181cbf08 |
|
BLAKE2b-256 | c9c61cb258e2670cb6c7148ada17a7c06bad623e75f146e2950ab9ea077acb26 |
Hashes for pyodps-0.11.5b1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0064f6d385c8342495d45edc0e1a13351678be1a875203fabe86445e4512e462 |
|
MD5 | 6d65a9a32b0a4e22a0ee09f3b1cf67e4 |
|
BLAKE2b-256 | d3db25139c8c1e66e06b6fdf1a9245078df856cdba038d93c4c393aea8f61dcd |
Hashes for pyodps-0.11.5b1-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 325b80ac23c9669799b225cdd4a95296b408ea1d7db4c06f5f54be7d6818ee56 |
|
MD5 | b826fde618f0103eddc05fa72a011b3a |
|
BLAKE2b-256 | 44f94a62b37a6a5059a76f0b6d0d4570af66bce5509678acdd6cad6ae095338b |
Hashes for pyodps-0.11.5b1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd47140c71b4264f4ea996a5845a07404eff5fa0728a76851d3597b81b154644 |
|
MD5 | f43d03890dee180b6751209b00f42e1a |
|
BLAKE2b-256 | e4a0232df5d8675cd2928244b73e2ce0f7c4a4861d5ff3eb1847eba23815ee3e |
Hashes for pyodps-0.11.5b1-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19e203766c9a49e98270e8f5607489ef9c15839c55f38dc9b0c9b4625dd53459 |
|
MD5 | eb74d0d34416ec80c7d95e8bb37720b2 |
|
BLAKE2b-256 | 91202d3509c39b4e5d3e056f04d467c52097c97e1b17d1f79ff922663244ef50 |
Hashes for pyodps-0.11.5b1-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 627d4cbf8cdc6c44e9d2ee8b113adbce42843ac6f59e65d5e17f4c2b9777d8dd |
|
MD5 | a0251401d5b3c15746e9139d8978494c |
|
BLAKE2b-256 | 6db37c0fcc3634448babb647d0eeff1393608fbec03786a1df4b48218803bad4 |
Hashes for pyodps-0.11.5b1-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e2f912d60b821c9014e8c33e13e6619eab41c2a7c5d1deca691c4c09da7cef2 |
|
MD5 | 47d23cd14bb548212c0e265e09a7b6e2 |
|
BLAKE2b-256 | 626b3a8ce954558c09588d06f82a7453ff7bf6b723f244136ae10386cf30dad7 |
Hashes for pyodps-0.11.5b1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7aaf87f3fdcb0028c918da3ee267a9152c4b7ec218896b9ad7774d3022d0ea2 |
|
MD5 | c650cb79069f8b561e14d013cacb0081 |
|
BLAKE2b-256 | ad37f622d1d1962d3fc91a18dc15ccc7b651bf2d1b7cc6a6bf7aeab76fc900f3 |
Hashes for pyodps-0.11.5b1-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81639812dfb2d79e6eb08660a798cbc1da04146734295d4781398bb9461378bd |
|
MD5 | ac0e27a653600d50855012b3bc2a8384 |
|
BLAKE2b-256 | a2772f1b04718ac30783727ec3511c87933bad20cd46ae1eb55e07f9305aa31b |
Hashes for pyodps-0.11.5b1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5cc0509431b269e108413c60ea2bb90823e61cd012fbdd82eebf1d22ca3cd17 |
|
MD5 | 28f6379a1c1c0771a57542528d863f9d |
|
BLAKE2b-256 | b5a0f8711d477bf71fa98c571f11d57ee9a37f3e3b9a8a5ea93ffac1e2581d05 |
Hashes for pyodps-0.11.5b1-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62ec420de116d7f84736418e72db418d51fd685aab241ecbc30b81110fdd8903 |
|
MD5 | fe91dceb72017bd433695dd85d7992ca |
|
BLAKE2b-256 | f1ad7ee58b0dfada94fb5ab268aa76ad0ca2a9ca9345e83f1d997f8b4527d980 |
Hashes for pyodps-0.11.5b1-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1319c85ed217e09dc625054a5f2d574de7272bbc38d8ae8f3b2a320d73061cc |
|
MD5 | 0d382d86f98b127899345fe1a8bd778f |
|
BLAKE2b-256 | f65011e383ea4d42f82fb04dc9da92bc37f2e8c76119fe1f81f49c8c992ef4dd |
Hashes for pyodps-0.11.5b1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34d1de940b53382e709438f7ba3bc77440ff7d52b02a5e33e1a748e3f29f5754 |
|
MD5 | 2fa40dfbc5c58d8b9c21e86ba8cdb2f1 |
|
BLAKE2b-256 | 2e28ac6bfa37063b510ca3a84f9b7d526a7d857c011ad73fc73f86f317653822 |
Hashes for pyodps-0.11.5b1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2eb6e35cb34bfe2e6cacf68fa8664860ae4233fba4f6aa48424ddedf539dc077 |
|
MD5 | 38769fa641d2305f63128fa2074c48fc |
|
BLAKE2b-256 | 5be5fbdd5f79d882fae5d5ab339f90b5cbfda8a1a18776828dcce447b479ef2c |
Hashes for pyodps-0.11.5b1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14e791904ba9ae295a71f45dc84caeb48c8835612cc1552ad14285ae7f944384 |
|
MD5 | 720b014f7c591f952c451fe2bffd6a0e |
|
BLAKE2b-256 | d2fd4b3d8b7e50a6900bb4990f92c232ac60832f5de61235f47afaba40db5095 |
Hashes for pyodps-0.11.5b1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8687861244ec2c43f872a75785345cee5e38746d8afca010a2f6b7a5c373d4b2 |
|
MD5 | 14fd647aeca6f0c91464c91150837ca6 |
|
BLAKE2b-256 | 3717ca166c86ce3b385c167fb9025a385ef83c0d81da69259ad31eeb7cdfba4e |
Hashes for pyodps-0.11.5b1-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c81c410f98dffaa0d12c2d8535fc3e0ca5abdf4a668960508981215408463d4c |
|
MD5 | 3eed55ec2506293d75dde0db3bf3571f |
|
BLAKE2b-256 | dbcae60a3c9d1960bcfb03bf554787fc63eeffbee1be776a160baaf1daa969e8 |
Hashes for pyodps-0.11.5b1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 444b3570fac98d5f9c9fc90ecef26e51bb8771ea646b56b0bfe72005deb9ea95 |
|
MD5 | 05067cf7e2be649a82eb445eed29ae4f |
|
BLAKE2b-256 | c250859d561e5af857242c8c02d6ae6ddb441c1922b1b803a739d72707ef244b |
Hashes for pyodps-0.11.5b1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31ad9d68686fb2a9b51ed45f99b7d3370de6f9a8e6513e3a7f0c18ec6566412c |
|
MD5 | 61f3615bd6ddeb91e108f786e266684e |
|
BLAKE2b-256 | a0de733ea64999d67d4ab63deae6479b29df0ee37f5c264e2978fa968cd28cc8 |
Hashes for pyodps-0.11.5b1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e353ac408c51db2f7d557b4247a0c6863381aa323d010aefe65e3bd0273298f |
|
MD5 | bf8aeab1c6ed53f6513fc3e8f28aba31 |
|
BLAKE2b-256 | e355f4d54ed1a5fff1ae60c63cff9c9f55f53e280fe916403ef22541000fb3de |
Hashes for pyodps-0.11.5b1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b383b815a4b51a2d129a92293c36b860eb356743e354ae9d6a708c06f992d7bb |
|
MD5 | 7b6705faef961cd119e6f45db7f663f2 |
|
BLAKE2b-256 | 24dcf4c3ddd42ee44ae21e627faf2c4d93e93b5d6a4a61ac58eb997805ada303 |
Hashes for pyodps-0.11.5b1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 229261208b33d0bad3ac89908cd80cea523cd78d0977bf7906cc67a73a9e3252 |
|
MD5 | a9156245430c25934f4a469d19e62799 |
|
BLAKE2b-256 | 3d897762be557c35af05152f0359d2a3e09838eb88b33894e2f5134a1f924b47 |
Hashes for pyodps-0.11.5b1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd8b779a87f8a530c0e1458c4d619872ebc9a66adc57b4d7220a53d2cdf5cd35 |
|
MD5 | 5fa95dfc3aebf8f10851679efd404baf |
|
BLAKE2b-256 | b03d62a4bd270d832cc7dc0b228685b582fb4ad8c1e78769dc7e557e6ac01f02 |
Hashes for pyodps-0.11.5b1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b414b97cee2ea8a8784b611f528b479ad3bdea26301210aced98b43cfe4e928d |
|
MD5 | eb80f4f34e052344bec19f9d13bb13aa |
|
BLAKE2b-256 | 112cf59840c2ade9afaeacf261ea681bd9be3112a62f849d96cc35b701793aff |
Hashes for pyodps-0.11.5b1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5114e65ecea318146b7b526cbff82e4219f04dbc06aa1901b39fc19ec39dbd96 |
|
MD5 | 66cfb5c4035fd0ce719643f943f53249 |
|
BLAKE2b-256 | b6106b64d344f0b638425e7e505c02467445bf2049fe2f9a09ae39bac3d4ec2c |
Hashes for pyodps-0.11.5b1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 186e214d67a0495277e86ba3f585fe93a445b18c3a7a4351b8821d0685090737 |
|
MD5 | 1ded0811dc63ba8d1deeca44edbde27c |
|
BLAKE2b-256 | fc5360f7bbf222c37791f23ae68f9f04e4dc57f2190bcfb741914d39e08fd735 |
Hashes for pyodps-0.11.5b1-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e91e773aaeca99f8a82792c2ee798a2fc0fe894734fc52174a11f3f2e2c0b897 |
|
MD5 | 7872a01d3ad14060814a28feadfa095d |
|
BLAKE2b-256 | d141af57a6c5e32b7cad663c40d3d711577b0b6f9c2908d5063d7b1c7402300b |
Hashes for pyodps-0.11.5b1-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 800dea3e55a60a81dd18f2525a513dcecd46d124461912fa46b5629c4865b26b |
|
MD5 | 0f0feb64d24a51b3a9f75061925be9a7 |
|
BLAKE2b-256 | 6cac5fe4ecd9af97b15395c5c1a64c6b2ae451626180790e709f11244e764e8d |
Hashes for pyodps-0.11.5b1-cp27-cp27m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3278084fa7beac9a4e71d457d9f156782280b74d6570c59791272701afcadc7 |
|
MD5 | 9963ac8a03074689e8a7ab425ab4c007 |
|
BLAKE2b-256 | 5f96ae5fce48056cfc95e493aa15288c6f7a71ec32a5f970add2e598e17e9d79 |