Skip to content

Commit

Permalink
fix #13 OK #1 DESC DOC OK
Browse files Browse the repository at this point in the history
  • Loading branch information
josuebrunel committed Aug 16, 2014
1 parent 0a393da commit d806ed2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ Changes the data provider
>>> yql.use('http://myserver.com/mytables.xml')
```

- desc(tablename)
-----------------
returns table description
```python
>>> response = yql.desc('weather.forecast')
>>> response.json()
{u'query': {u'count': 1, u'lang': u'en-US', u'results': {u'table': {u'request': {u'select': [{u'key': [{u'required': u'true', u'type': u'xs:string', u'name': u'location'}, {u'type': u'xs:string', u'name': u'u'}]}, {u'key': [{u'required': u'true', u'type': u'xs:string', u'name': u'woeid'}, {u'type': u'xs:string', u'name': u'u'}]}]}, u'security': u'ANY', u'meta': {u'documentationURL': u'http://developer.yahoo.com/weather/', u'sampleQuery': u'select * from weather.forecast where woeid=2502265', u'description': u'Weather forecast table', u'author': u'Yahoo! Inc'}, u'hash': u'aae78b1462a6a8fbc748aec4cf292767', u'name': u'weather.forecast'}}, u'created': u'2014-08-16T19:31:51Z'}}
>>>
```

- rawQuery(query)
-----------------

Expand Down
17 changes: 17 additions & 0 deletions lokingyql/lokingyql.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,29 @@ def buildSelectQuery(conditions):
#
#####################################################

##USE
def use(self, url):
'''Changes the data provider
>>> yql.use('http://myserver.com/mytables.xml')
'''
self.url = url
return self.url

##DESC
def desc(self, table=None):
'''Returns table description
>>> yql.desc('geo.countries')
>>>
'''
if not table:
query = "desc {0} ".format(self.table)

query = "desc {0}".format(table)
response = self.rawQuery(query)

return response



## SELECT
def select(self, table=None, items=[]):
Expand Down

0 comments on commit d806ed2

Please sign in to comment.