Skip to content

Commit

Permalink
#1 : updating use method documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
josuebrunel committed May 18, 2015
1 parent de4046b commit 3ad6fde
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ u'<?xml version="1.0" encoding="UTF-8"?>\n<query xmlns:yahoo="http://www.yahooap
Methods
-------

####use(data_provider_url)
####use(yql_table_url,name=yql_table_name )
Changes the data provider

```python
>>> yql.use('http://myserver.com/mytables.xml')
>>> yql.use('http://www.josuebrunel.org//users.xml', name='myusers')
```

####desc(tablename)
Expand Down
88 changes: 84 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ MYQL
====

`|Build Status| <https://travis-ci.org/josuebrunel/myql>`_
`|Documentation Status| <https://myql.readthedocs.org>`_ `|PyPI
version| <http://badge.fury.io/py/myql>`_ `|Join the chat at
`|Documentation Status| <https://myql.readthedocs.org>`_ `|Latest
Version| <https://pypi.python.org/pypi/myql/>`_
`|Downloads| <https://pypi.python.org/pypi/myql>`_
`|Status| <https://pypi.python.org/pypi/myql>`_
`|image5| <https://pypi.python.org/pypi/myql>`_ `|Join the chat at
https://gitter.im/josuebrunel/myql| <https://gitter.im/josuebrunel/myql?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge>`_
`|Code
Issues| <https://www.quantifiedcode.com/app/project/gh:josuebrunel:myql>`_
Expand All @@ -23,6 +26,23 @@ Yahoo! Query Language Documentation and Support
Release Notes
=============

v 1.2.2 ( development )
-----------------------

- Fixed issue with **IN** condition in **where** clause
- Fixed issue when passing an empty list/tuple (**[]/()**) in a
**where** clause
- Import of StockParser from Gurchet Rai
https://github.com/gurch101/StockScraper OK
`#68 <https://github.com/josuebrunel/myql/issues/68>`_
- Insert, Update, Delete methods added
`#67 <https://github.com/josuebrunel/myql/issues/67>`_
- Dummy *try/except* removed from main module
- Fixed **Invalid OAuth Signature** when using a refreshed token
`#64 <https://github.com/josuebrunel/myql/issues/64>`_
- Fixed misused of ***MYQL.use(...)***
`#76 <https://github.com/josuebrunel/myql/issues/76>`_

v 1.2.1
-------

Expand Down Expand Up @@ -173,11 +193,68 @@ instead .

::

>>> yql.get('geo.countries', ['name', 'woeid'], 1)
>>> rep = yql.get('geo.countries', ['name', 'woeid'], 1)
>>> rep.json()
{u'query': {u'count': 1, u'lang': u'en-US', u'results': {u'place': {u'woeid': u'23424966', u'name': u'Sao Tome and Principe'}}, u'created': u'2014-08-17T10:32:25Z'}}
>>>

insert(table, (field1, field2, ..., fieldN),(value1, value2, ..., valueN))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Insert values into a table. Arguments 2 and 3 may be **tuples** or
**list**.

::

>>> response = yql.insert('yql.storage.admin',('value',),('http://josuebrunel.org',))
>>> response.json() # result prettyfied just for the example
{
"query": {
"count": 1,
"created": "2015-05-14T13:25:56Z",
"lang": "en-US",
"results": {
"inserted": {
"execute": "store://KkkC5xDw4v32IcWWSQ4YRe",
"select": "store://Zc5LHXcmYM7XBfSbo9tzFL",
"update": "store://Rqb5fbQyDvrfHJiClWnZ6q"
}
}
}
}

update(table,[field1, ..., fieldN],[value1, ..., ...valueN]).where(filters, ...)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Update fields values. This method **is always followed by
***where()*****. Arguments 2 and 3 may be **tuples** or **list**.

::

>>> response = yql.update('yql.storage',('value',),('https://josuebrunel.org',)).where(['name','=','store://Rqb5fbQyDvrfHJiClWnZ6q'])
>>> response.json() # result prettyfied just for the example
{
"query": {
"count": 1,
"created": "2015-05-14T13:32:52Z",
"lang": "en-US",
"results": {
"success": "Updated store://KkkC5xDw4v32IcWWSQ4YRe"
}
}
}

delete(table).where(filters, ...)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Delete records \`\`\`python >>> response =
self.yql.delete('yql.storage').where(['name','=','store://Rqb5fbQyDvrfHJiClWnZ6q'])
>>> response.json() # result prettyfied just for the example { "query":
{ "count": 1, "created": "2015-05-14T13:38:28Z", "lang": "en-US",
"results": { "success": "store://Rqb5fbQyDvrfHJiClWnZ6q deleted" } } }

\`\`\`

Using OAuth to fetch protected resources
========================================

Expand All @@ -193,7 +270,10 @@ Using OAuth to fetch protected resources
Status| image:: https://travis-ci.org/josuebrunel/myql.svg?branch=master
.. |Documentation
Status| image:: https://readthedocs.org/projects/myql/badge/?version=latest
.. |PyPI version| image:: https://badge.fury.io/py/myql.svg
.. |Latest Version| image:: https://pypip.in/version/myql/badge.svg
.. |Downloads| image:: https://pypip.in/download/myql/badge.svg
.. |Status| image:: https://pypip.in/py_versions/myql/badge.svg
.. |image5| image:: https://pypip.in/implementation/myql/badge.svg
.. |Join the chat at
https://gitter.im/josuebrunel/myql| image:: https://badges.gitter.im/Join%20Chat.svg
.. |Code
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ u'<?xml version="1.0" encoding="UTF-8"?>\n<query xmlns:yahoo="http://www.yahooap
Methods
-------

####use(data_provider_url)
####use(yql_table_url,name=yql_table_name)
Changes the data provider

```python
>>> yql.use('http://myserver.com/mytables.xml')
>>> yql.use('http://www.josuebrunel.org//users.xml', name='myusers')
```

####desc(tablename)
Expand Down
4 changes: 2 additions & 2 deletions docs/myql.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ cond = ['yid', '=', 'josue_brunel']

#### *MQYL.buildResponse(response)*

#### *MQYL.use(url)*
#### *MQYL.use(yql_table_url, name=yql_table_name)*

Change the service provider

Expand Down Expand Up @@ -119,4 +119,4 @@ List all tables

Return a user *guid*

* ***username*** : yahoo id i.e 'josue_brunel'
* ***username*** : yahoo id i.e 'josue_brunel'

0 comments on commit 3ad6fde

Please sign in to comment.