Codaio: python wrapper for Coda API

Hi guys,

I have started working on python wrapper to use with Coda API. Please take a look here:

or install with pip install codaio

You can already use it for convenient reading of tables, more details in the README

It would be great if somebody was feeling like contributing an issue or PR. Thanks!

6 Likes

The library now includes all methods of raw API under the Coda class to conveniently access the API via python. For object oriented access I’m working on Document, Table, Row, Column and Cell classes.

Documentation: https://codaio.readthedocs.io/en/latest/index.html

3 Likes

Hi,
I would be keen to have a look at this, is there any way to get it running with python 3.6?
Cheers

Thanks for your efforts. Python is my preferred option for scripting, and your wrapper seems to be very promising

1 Like

Hi, I don’t think there will any problem with 3.6, I just haven’t tested with it.

Try it out and let me know if you encounter any difficulties.

Hey am working with this now, its running great so far. Creating new docs, changing rows, retrieving data is all working great.

There is one function that my tiny brain can’t figure out though and thats the upsert rows.

Do you have a script example of using this, I have been trying your quickstart example

table = doc.get_table('TABLE_ID')
name_cell_a = Cell(column='COLUMN_ID', value_storage='new_name')
value_cell_a = Cell(column='COLUMN_ID', value_storage='new_value')

name_cell_b = Cell(column='COLUMN_ID', value_storage='new_name')
value_cell_b = Cell(column='COLUMN_ID', value_storage='new_value')

table.upsert_rows([[name_cell_a, value_cell_a], [name_cell_b, value_cell_b]])

I keep coming up with same error

Traceback (most recent call last):
  File "main.py", line 16, in <module>
  File "/lib/python3.7/site-packages/codaio/coda.py", line 884, in upsert_row
    for cell in cells
  File "/lib/python3.7/site-packages/codaio/coda.py", line 884, in <listcomp>
    for cell in cells
AttributeError: 'str' object has no attribute 'id'

Do you have a another example of the upsert function working. I know this is going to be a facepalm situation for me but my brain is stuck.

Cheers.

Sure thing, will update the example.

Meanwhile can you send me your code, I’ll try to help. You can use a service like https://del.dog to send a snippet.

Version 0.4.7 added to_dict() methods for use with pandas:

df = pd.DataFrame(table.to_dict())
1 Like

The Pandas addition in awesome, so easy to dump a whole table in with 1 line of code. :+1::+1::+1:

1 Like