Materialize: Add copy option to strip constraints from DDL#6422
Materialize: Add copy option to strip constraints from DDL#6422sougou merged 1 commit intovitessio:masterfrom
Conversation
30501be to
b8e212c
Compare
Signed-off-by: Toliver Jue <toliver@planetscale.com>
b8e212c to
03c8406
Compare
sougou
left a comment
There was a problem hiding this comment.
This is a good idea. The one problem with our DDL parser is that it doesn't handle all constructs. So, many constructs will fail if we went this route.
Due to this, I tried a different approach for modifying the DDL, which is based on knowing how mysql generates the create table string. I'm wondering if we can capture more use cases. Essentially, I massage the statement using string matches. Here's how I did it: https://github.com/vitessio/vitess/blob/master/go/vt/wrangler/materializer.go#L305-L331.
If this is too much trouble we can go with your approach knowing that it won't work for all cases.
|
@sougou yea, i was potentially worried about it failing for the general case. however @systay mentioned that this happened to work for constraints in particular. separately, i had formatted the one benefit with this PR's approach is that it should be robust to failure, and fail-fast, by not being able to parse certain constructs. so i'm inclined to have a relatively limited option first, knowing we can go with the more generalized approaches later. this has limited blast radius in event it's "done wrong". |
Signed-off-by: Toliver Jue toliver@planetscale.com
Add a
copy:drop_constraintcopy type to Materialize