Skip to content

Commit

Permalink
Search datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Nov 14, 2024
1 parent ae19a76 commit 2439eb8
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions odds/api/common_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,21 @@ async def fetch_dataset(id):
publisher=dataset.publisher,
publisher_description=dataset.publisher_description,
link=dataset.link,
resources=[
dict(
id=encode_id(f'{id}/{i}'),
name=resource.title,
num_rows=resource.row_count,
)
for i, resource in enumerate(dataset.resources)
if resource.row_count
],
resources=[]
)
for i, resource in enumerate(dataset.resources):
if resource.row_count:
response['resources'].append(
dict(
id=encode_id(f'{id}/{i}'),
name=resource.title,
num_rows=resource.row_count,
)
)
if resource.content:
response['resources'][-1]['content'] = resource.content
response['resources'][-1]['db_schema'] = 'no db schema available'

logging.debug('RESPONSE:', response)
return response

Expand Down

0 comments on commit 2439eb8

Please sign in to comment.