littleK0i / SnowDDL

Declarative database change management tool for Snowflake
Apache License 2.0
104 stars 27 forks source link

Target DB placeholder not available during singledb mode parsing #97

Closed AndreiTapai closed 6 months ago

AndreiTapai commented 7 months ago

Describe the bug While parsing a function (yaml with !include, sql file in sql/my_file.sql) i get back an error ValueError: Unknown placeholder [TARGET_DB]

Expected behavior According to the docs, this placeholder should always be available when the parameter --target-db is passed.

Can't attach log or yaml config sadly - however I was able to pinpoint the issue:

In singledb init_config the call config=super().init_config() happens before the target_db placeholder is set. Then, in super.init_config, the attempt to parse blueprints happens at line 281-282. This fails because of the missing target db placeholder.

Hopefully that is enough context. Let me know. I will try passing in the placeholder explicitly via command line until this is fixed.

littleK0i commented 7 months ago

@AndreiTapai , should be fixed in 0.25.3.

Placeholder TARGET_DB is now set earlier, so it can take effect before parsing of YAML configs. But argument --target-db must be set explicitly for this placeholder to work.

Thank you for pointing this out. We do not use SingleDB mode internally, so some issues might be present. I'll see if I can add more tests regarding to SingleDB mode specifically.

AndreiTapai commented 7 months ago

This worked. Thank you for the update.