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.5.post0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fc3e9f2a073c86712ba563d225f22572acd8161a680abba1d27d06ecbd19be6 |
|
MD5 | f881d26c9e5243f92198a28c507e09af |
|
BLAKE2b-256 | 5b8d80ff30a849ac528cf000aa4fa4a4283b8d78f6f8bff7ef1ee7f6abfe23bd |
Hashes for pyodps-0.11.5.post0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6337bfa08b3a81f40e967c7696f5a44d23c42284bca12534dc865697fa6c31b3 |
|
MD5 | 0c56239b4d310a90e411b7a504239c29 |
|
BLAKE2b-256 | a560352bec76b63b45b5c2eec6801e5ed12fa30bce79951ef0a17fde8e01de97 |
Hashes for pyodps-0.11.5.post0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc271b7d06a38c6e29deddfff13da702eae53a04ecc98acbade648be009b242f |
|
MD5 | 6fc9387614d914998b257a8f6f9ea763 |
|
BLAKE2b-256 | 0e8811005a1b843ed3ae81c7695f5f311fef385e0b43190a3164e9c6674536d0 |
Hashes for pyodps-0.11.5.post0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69978968d52938dfa06b7e67ec935302e0d9e17d25e9be84856f9f7ad6371f92 |
|
MD5 | 7dc524ed7e56fc3063cca412d9bc984a |
|
BLAKE2b-256 | 54f97bc7a847e4707b9ddeaa7043f943fe961a796054176e86aed19661673ddc |
Hashes for pyodps-0.11.5.post0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b8e5b3420420620f22296fa74f8b99abb03c1212451ef55672f888c5a6ee164 |
|
MD5 | 2f33b4c2821dd6cf3f991c144c4e8d07 |
|
BLAKE2b-256 | 880331b8c67dbfab508ed8e17ddf9e74ba4be0372449dbbe1b4847580df081ef |
Hashes for pyodps-0.11.5.post0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddbdb59fb1cd7404e9771f51dd15dbd49b949cb613b2838a9fb1b9304fdb7e07 |
|
MD5 | e9834c93ec2dcc6dbf31a6daa48435d4 |
|
BLAKE2b-256 | fad0c7473d39f1e381b6700f9288f2a0450a81d36bd1d2f78e6ddfd01340ff63 |
Hashes for pyodps-0.11.5.post0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc8cf3cdef0d5f2ecfd687bdaa67a2327f8ad479b33c133f110ab45ec604605c |
|
MD5 | 87e915bd7bcfbada8c5ab447da124777 |
|
BLAKE2b-256 | 182a41856ff5d0667883e36e21596697181c66de11a36c90f962ce3f66604b3d |
Hashes for pyodps-0.11.5.post0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94ae43659f3494e2e45bb71c2c5fe79e2d9565ea65463973f330d43fcc634e62 |
|
MD5 | fade97f2ca3245c4dcdcce81671ea37f |
|
BLAKE2b-256 | 4a8bc94b452d72c911de4d767e0e7309f4450d5b794f1e681ad500c53830f6f0 |
Hashes for pyodps-0.11.5.post0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70ac3b247ce936b4989e569fd4a78aef62641b745eaf78f997c1574a0d2931aa |
|
MD5 | 55562c5e95fdd528f00504621c9bb927 |
|
BLAKE2b-256 | fd4bdd56c640ede36f1db798d614b3de408021a262aa8dae647aff631c6f6b2f |
Hashes for pyodps-0.11.5.post0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | abec3182bced1d0d1c76bcc800f6f2ac58128f2658302244f1a0bb46980c8c1b |
|
MD5 | eed145d2f99fe87af76f1635aff1c205 |
|
BLAKE2b-256 | f1ff98b400537ea9fbb5494ee3a7a3121ae86485f8700eaf48d6796ccdebfbaa |
Hashes for pyodps-0.11.5.post0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cea66f3b81857b26abf7864f9675e053571d896f33846049815dc5580c55436e |
|
MD5 | 57c8d23f594288ed8589a3206cec49d6 |
|
BLAKE2b-256 | 8b77eac3db715e2d1cb32c6c34f2b817c509cbb7fcd14da9dc55997043f7d1bc |
Hashes for pyodps-0.11.5.post0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b167d6653d848142d1a1224df9fa926d7bfc285f1b1fed121b3999536b77a54 |
|
MD5 | 10507f4226ad6a7631106b65bac6b8f3 |
|
BLAKE2b-256 | 07e92f2a2cfe3d83eea19b12a525dd1e9d7d0e97ea953c7e24293dc1133982a0 |
Hashes for pyodps-0.11.5.post0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cbbc4f2ea7bd949498e04bd2e539934251c7ce83c0f8bd4824de1f5fc950b59 |
|
MD5 | 51b1ea79d9ebb4320298d53255844397 |
|
BLAKE2b-256 | 05919078a055511b4e0869b26a8f9258abe1d4f22c4b1381af44dfc0e1c873f2 |
Hashes for pyodps-0.11.5.post0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7112be1390a98e416ebc998837fec9f5e06ca68be5029a7435b82a02b97f64ec |
|
MD5 | dbed7ffd344d790537bac2942210798c |
|
BLAKE2b-256 | 6a639abec1c647414f41df8ba02ecc4bd0359ea70cca0e10faaadbc9bdfcef81 |
Hashes for pyodps-0.11.5.post0-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a4a71ebf782921f5a523479edf14bc4c3c5b1c693bb45c59a81ea56a6337779 |
|
MD5 | 9192e3d22f807404537f6e03c6f3a7d2 |
|
BLAKE2b-256 | 692e40a6cc0db7e4ef7b220fb358412d2fdb6749efb96d478b58b174feafae90 |
Hashes for pyodps-0.11.5.post0-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6c047fa0467a965149dd66f7abc8e0cca98e6823cabf395ed8fc506074ba11f |
|
MD5 | a112f9e4ceffffb472b90becc5db0e2e |
|
BLAKE2b-256 | 3a59343ca94c52a5c2c2a4f27f858876f4877469ce270527f0eda9601ae97c29 |
Hashes for pyodps-0.11.5.post0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab87d52a65cbb77bde65b09c74ba5d4b7f86785318fe54ac489e6ebde29c578f |
|
MD5 | 6900acdc3f5c48e2b561225a147fd0f9 |
|
BLAKE2b-256 | 0eef364550aa32646b6af811494a0d14a361e4f27e9e564fe30c888ac8c56c7f |
Hashes for pyodps-0.11.5.post0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebd599669ee0091ce8321ffb57d948b6607db3042c4921a5434f2f5f5bc0e318 |
|
MD5 | 3b04e4aecf0e722473a8db821c00d3cd |
|
BLAKE2b-256 | 91a710f64b8252b66d2659526574b9db13b10afbb5f2432e57920fe7eeb93083 |
Hashes for pyodps-0.11.5.post0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c1093e3230e9cc43fb032d1c3437b2a08b96683ddae747807bf01355afb35ec |
|
MD5 | b96477c7040f10de0068732bb5540518 |
|
BLAKE2b-256 | a6a48717304895d17af34b7b094f1d7e76aea7508423c1a5c21183347f44b7b3 |
Hashes for pyodps-0.11.5.post0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b88a39dc02990080f6d611636fad67a16a28cf18cea00fc6aa556f02474f57e4 |
|
MD5 | 0cbead1cd910febee9b1ce56d416ab6f |
|
BLAKE2b-256 | 364f0d809fa7fbc797537340e7a90a616786bedacab44ce1f184bba7745d56bc |
Hashes for pyodps-0.11.5.post0-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 991753e0122aec8d1d200a73fea37f89810b91ad5495c12ea640c01fb6687b76 |
|
MD5 | 523107e38fd07dcfe8f10288035a7b3d |
|
BLAKE2b-256 | 86b762a7fa87203bc4edcfd1f26fa7fe4c8d46e2f9a11093097c436a8f47e257 |
Hashes for pyodps-0.11.5.post0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ed335cafe075bb488842d85b368aac2f5fde6cc2da54edb726110e2e3710d49 |
|
MD5 | 3ed9bab580e64a579359fa2a6f28a302 |
|
BLAKE2b-256 | 529a289f13b02c65e165b0134805b448fac62713437e6028fb1cedb6b709b20f |
Hashes for pyodps-0.11.5.post0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40cb788689dd0f650fc6925001715f92d297c01c9173ac81ab5f47d3e49eb440 |
|
MD5 | 349b7d60a87dc2305d597e19f4c9c0f9 |
|
BLAKE2b-256 | 70f170c771fa3a8270ddcdcfc3628819ff9289243a9048c9df55456fda5f7a03 |
Hashes for pyodps-0.11.5.post0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c929479cee8ff9919ef74668a948502194a68794d63c9924cb9bcb1614c8737 |
|
MD5 | 67574f5b00f18c0d75a8ae5b8f4ab9cd |
|
BLAKE2b-256 | fbdc81f1ec21c3b77f2623c831e5620f3248fff5a4d24c7892fcbb845f815ded |
Hashes for pyodps-0.11.5.post0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5b5a6bc0d4b8f806d34a692d527a1f6ae138fe7f0bacc3b6b80ab677a065a61 |
|
MD5 | 81d349c4fd3051ae6328df9f76d9f886 |
|
BLAKE2b-256 | 0dd7c9fa11c8061b273a6843242be9cfce6e05106af400765aab09e6312826b3 |
Hashes for pyodps-0.11.5.post0-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98f98c2453a41932ce09b1555def9ee7a2f4458699b3955146d173ab22ad66a3 |
|
MD5 | 9b022f9fe094aadde1d1972d4dbc3202 |
|
BLAKE2b-256 | bb1920741d33a2291b29177a28e0788925c805ff46b8f7f5895cd0d375a010b2 |
Hashes for pyodps-0.11.5.post0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f7cc72b223176981f0aa6994287873d348648db97b318adf969583bbe4489b2 |
|
MD5 | f646dab471ac57f1cdfa68e973144d66 |
|
BLAKE2b-256 | 372bd6fb0227303d96c81c8e3000b4af790371256f2fc4e7146b2cce46148e80 |
Hashes for pyodps-0.11.5.post0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aca85d854065b58df5887cd34074934dc6dc111422584a70dc0b054698a7f315 |
|
MD5 | 0249a2df9f0db6099e8e817ca6cdd836 |
|
BLAKE2b-256 | 7f94639501449835ce73fb11043d4871fafca4bb4181bff203e1d1c0390d67b5 |
Hashes for pyodps-0.11.5.post0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aca799695b6e6daa4c834d00fcb494af080e2b401c759fceb7a9502fbeae940f |
|
MD5 | 892e89527460413eb26b6cc42cd82815 |
|
BLAKE2b-256 | e7dc876c54922bb8cd6baff5491e6e601348ef525a2cb31646755de9c0a580bd |
Hashes for pyodps-0.11.5.post0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0f7f8d514d382e02d710b8b0f30e960d7d33403af0a2160deede8187ba34e97 |
|
MD5 | d5b8acaef7d1c09181fe776e7d111d57 |
|
BLAKE2b-256 | 685357f0868b443c61b69803b86312263ce7b23e16776d146c8de8e51860acc1 |
Hashes for pyodps-0.11.5.post0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dea85ab3c63b8ee5deb3a19b07b89599c377839fdc46c3fcd2b11cce73fb1854 |
|
MD5 | cffd669b2d667ed686ae0fc596abbc30 |
|
BLAKE2b-256 | 20bf46f98480e67f9483a468035ca0a43887d05574c689e0b0e99280978c73c4 |
Hashes for pyodps-0.11.5.post0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 647141aa332aac88102db7c3fc6ee7c8eaa69dd6cf79583e0885dba47bfeecf5 |
|
MD5 | eb8ddb113517c2881057ec7e27c1b205 |
|
BLAKE2b-256 | 89b152683d55d539a300863ec15f16fd85a83ffd23c8b677e9cd01db99a35646 |
Hashes for pyodps-0.11.5.post0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 279b15e191d315e8b2fc9d1a53a5f1245162f354a444c09afd73a6eaa13d426f |
|
MD5 | 1c620be80e606e662d89770acb608674 |
|
BLAKE2b-256 | 116446f78e2051ac10176e267f9d5ed03f93a254ab10f559f3e5ba78ec9197f9 |
Hashes for pyodps-0.11.5.post0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e2ab6053866e333e412a2fd588832afe24bd92b17fee7a658ac7a19fae7ca56 |
|
MD5 | 85fdcade8ba6fa247ee206f3ac65f051 |
|
BLAKE2b-256 | e173fc139e3fcdedf89cfdbed05550f29954d37361d273ad406938e6b5466198 |
Hashes for pyodps-0.11.5.post0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5228bce24047bec1d57e119e8048c1bf14a1fe0e45c157c6f81d612218b14bed |
|
MD5 | 539eaa8dc8a1283d0f073c9eff4a3282 |
|
BLAKE2b-256 | db5b866d15fd5e7e2fc9f8c09ca65469ea9d644bbd0a97d4e72b6fcd8af74118 |
Hashes for pyodps-0.11.5.post0-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a176af644d3ba1b6f37a0a8c3ad07e8ef3da97400dfe72572e8b6b147515b41b |
|
MD5 | 1d06dce91c6a8d789f269b379ae88e0d |
|
BLAKE2b-256 | 881c83ac94fc36b97c994072f1d3184f9eb7e8eb4395135d7cb385471489abb3 |
Hashes for pyodps-0.11.5.post0-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bffe21b9a3ebb295bfa0188d35d87db49d5ee31a0aed9d0048cef01bb0621f20 |
|
MD5 | b5ae93a674d4ffef78a9665863b2bd09 |
|
BLAKE2b-256 | 6cd5e663a41710a60584b47249ea24751e2f9b33995a64eb89ac32f5abb780b9 |
Hashes for pyodps-0.11.5.post0-cp27-cp27m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0315e9480d1d998f01282d8cb74eaa8b5b095210c5ea385c94338f17e573944 |
|
MD5 | 87652032857eb580402c57b422c4d75c |
|
BLAKE2b-256 | f5c57b5d5d2580ef89b57dbb1fbb60d49accc61bfa9f86ee52cc7bd39aacba07 |