Help

Re: Metadata API for schema and mutating tables

4677 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Simon_Horup_Es1
6 - Interface Innovator
6 - Interface Innovator

Is there any plan for an API to pull metadata? It’s currently very difficult to infer the schema, you have to resort to hacks like reading all records and then trying to infer types and column names from that. It’d be great if you could pull the schema information for a table more easily!

It’d also be awesome if you’d be able to add and change tables from the API, but that’s less pressing to me :slightly_smiling_face:

40 Replies 40
Felipe_Edoardo
4 - Data Explorer
4 - Data Explorer

Sometimes it’s hard to understand whether Airtable really is trying to be a professional solution or not.

Are you guys aware of the many ways that have emerged to get at the schema? Here’s one. There are others like this one, and this one.

Yes, because clearly a hack is much better than a proper metadata API.

Tom_Beckenham
4 - Data Explorer
4 - Data Explorer

Is the way to do this now to create a custom block? Looks like its possible through that - Airtable Blocks SDK

DanielAssayag
6 - Interface Innovator
6 - Interface Innovator

I know this is a bit of middle ages as you have to press the button RUN everytime you need to modify your tables…
But i got this as a compromise.

Create a new table where you will store your Schema.
I called it ‘Ledger’ just for clarity.

create a block and use this code, it will populate it with the names of your tables, and then you can use it to make api calls.

let ledger = base.getTable('Ledger');
let tableList = []

for (table of base.tables) {tableList.push({fields: {'Name' : table.name}})}

await ledger.createRecordsAsync(tableList)

if you want to avoid async random return order of your records you can store it in a string and then parse it as an array in your app.

let ledger = base.getTable('Ledger');
let tableList = ""

for (table of base.tables) {
    if (base.tables.indexOf(table) == base.tables.length - 1) {
         tableList += table.name
    }
    else {
    tableList += table.name + ", "
    }
}

await ledger.createRecordsAsync([{
            fields: {'Name' : tableList }
}])

Should be native, no? :frowning:

I don’t understand your comment. I’m very old; give me more context.

douglaslassance
6 - Interface Innovator
6 - Interface Innovator

I would love to be able to create an object-oriented Python API for my Airtable base. The current inability to query the schema definition via the API is a problem.

And I’m feeling old. Perhaps best to move along :grinning_face_with_big_eyes:

I tried this and it works great!. I save the json out to a file, then load it into python / dataframe for various uses. Thanks Chester.