sql: support deriving SQL schemas from AVRO definitions
is it possible to have Avro support or other format, insead of hard create schema with SQL,
Epic CRDB-8969
Jira issue: CRDB-5859
As far as mapping field types to some reasonable default sql types -- we can certainly do that. Where things start getting interesting is:
- When the mapping is not correct -- for example, we have avro bytes, but we want to have a timestamp.
- Indexes -- we probably should have a way to specify those in avro schema.
What makes me not very happy about this situation is that neither of the above problems seem to have a standard solution.
For the first issue, we might say that spanner is the "standard" -- google spanner adds a field to it's export called sqlType For the second issue,. there doesn't seem to be any standard-ish way. We could say that for our db, you can add "indexes" array: indexes = [ {name = "idx_primary", type = "primary", fields = [0, 1, 3]}, {name = "idx_sec", type = "secondary", fields = [4]} ]
I think it's a question for product (@mwang1026 ): Do we want to bother with that, or just ask the users to create the table.
I think it's a nice to have. We've filed this in the IMPORT backlog and will figure out timing. For now, we do have AVRO support but without auto-schema creation.
Quick feedback from the Bulk IO team: good potential here, keep it in the backlog.
We have marked this issue as stale because it has been inactive for 18 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to CockroachDB!