Henning Holgersen
01/25/2023, 7:58 PMaaronsteers
01/25/2023, 9:53 PMIt doesn’t take a lot to add column comments when a table is being created, but adding column comments for new columns is a little more involved because the methods that create the new column only takes the column name and column type as argument, not the entire schema.
Valuable info! Thanks for sharing this back!
Henning Holgersen
01/25/2023, 10:20 PMaaronsteers
01/25/2023, 11:14 PMHenning Holgersen
01/29/2023, 8:50 PMprepare_table
must pass the variable property_def
into prepare_column which must pass it into _create_empty_column
Sqlalchemy isn’t very helpful with adding columns, and therefore not with adding column comments either. Developers of each tap will have to figure this out themselves. But it isn’t hard, and the SDK’s logic doesn’t have to bother with column comments.
It might be natural to do something similar on alter column statements, which I think would follow the same pattern.aaronsteers
01/30/2023, 12:00 AMColumn()
constructor similarly accept comment=...
in the _create_empty_column()
implementation here by chance? (I'm guessing no, but just want to confirm.)Henning Holgersen
01/30/2023, 6:45 AMaaronsteers
01/30/2023, 5:36 PMStill, nothing fails by adding it.Nice. In a base SDK implementation then, I think if column comments are enabled in the tap, we might as well send them in the constructor just in case the implementation is able to handle it automatically. And then developers can additionally provide custom implementations if need+interest is there to improve the implementation.
Henning Holgersen
01/30/2023, 8:56 PMproperty_def
through to _prepare_empty_column
is a nice first step, but we did mention something about default behaviour and particularly @visch didn’t want to auto-populate column comments from his description field. Not entirely sure what a good pattern for defaults should look like. I often come back to if-else’ing huge blocks, which probably isn’t the most elegant way.visch
01/30/2023, 9:14 PM_sdc_column_comments
and have it be an object
it'd be an extension that we'd be defining. Description just fits so well that I can see using it here and telling anyone that doesn't use description properly to go make their own field like I'm describingvisch
01/30/2023, 9:15 PM