cockroach icon indicating copy to clipboard operation
cockroach copied to clipboard

sql: support deriving SQL schemas from AVRO definitions

Open hamroune opened this issue 8 years ago • 4 comments

is it possible to have Avro support or other format, insead of hard create schema with SQL,

Epic CRDB-8969

Jira issue: CRDB-5859

hamroune avatar Feb 04 '18 13:02 hamroune

As far as mapping field types to some reasonable default sql types -- we can certainly do that. Where things start getting interesting is:

  1. When the mapping is not correct -- for example, we have avro bytes, but we want to have a timestamp.
  2. 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.

miretskiy avatar Mar 20 '20 19:03 miretskiy

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.

mwang1026 avatar Apr 15 '20 18:04 mwang1026

Quick feedback from the Bulk IO team: good potential here, keep it in the backlog.

shermanCRL avatar Jun 22 '21 19:06 shermanCRL

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!

github-actions[bot] avatar Sep 26 '23 11:09 github-actions[bot]