fsprojects / AzureStorageTypeProvider

An F# Azure Type Provider which can be used to explore Blob, Table and Queue Azure Storage assets and easily apply CRUD operations on them.
http://fsprojects.github.io/AzureStorageTypeProvider/
The Unlicense
84 stars 34 forks source link

Type provider fails on empty tables #97

Closed mathias-brandewinder closed 7 years ago

mathias-brandewinder commented 7 years ago

Description

The type provider becomes unusable for tables that contain no entries.

Repro steps

Create a table, add some entries Use the type provider to great success Remove all the entries No more great success; methods like GetPartition disappear.

Expected behavior

If a table exists, I believe it has metadata available, describing what types each column is supposed to contain. I presume the Type Provider uses actual entries, and not the metadata, to generate types, would it be reasonable to use that as a default?

Actual behavior

Known workarounds

Keep a row in any existing table, no matter what?

Related information

I realize this is probably not a verycommon case - tables will typically contain data. Yet, in early design phase, it's not uncommon for me to run code, see how the data looks, then wipe out the data to change a couple of things.

isaacabraham commented 7 years ago

Sadly, your assumption regarding table metadata isn't correct AFAIK. Azure Tables hold row level metadata only. There's no such thing as a table schema.

This is something I have on the backlog but need to define a schema definition etc.. - I've created #98 to track this.

mathias-brandewinder commented 7 years ago

That's interesting - I based my assumption on the fact that, in the Azure Storage Explorer, you can display columns, and some type information shows up there. So tables also infer types on rows then? Anyways, I trust that your knowledge on the matter is deeper than mine, and I think the approach you suggest (providing a sample/static file) sounds quite reasonable. Thank you! And this might make a good up-for-grabs topic, perhaps?

isaacabraham commented 7 years ago

Indeed - #98 has the up-for-grabs tag :-)

Actually if someone wanted to just write the schema definition and a simple domain model for it (e.g. discriminated union for the different EDM property types etc.) with parser that would be a massive help after which I can just integrate it with the TP.

We took this approach for the schema support for blobs and it worked well.