Hi! I am currently setting up an airbyte (OSS) pip...
# replication-troubleshooting
u
Hi! I am currently setting up an airbyte (OSS) pipeline to pump Data from an MS SQL-Server to Big Query. This has been a lot easier than I had anticipated. But I am experiencing a problem that I fail to solve myself. And the solutions I stumble upon, involve an amount of knowledge that I can not ingest at the moment (eg. DBT). My issue is, that the SQL-Server datasource converts dates to strings in json. The Big Query destination connector could convert this back into a date if the format-label in json would be set to date-time, but that is not the case. And that seems to be the end of the documentation. There would to be a solution to that, by writing a transformation in DBT myself, but that would make me rewrite that transformation every time I add or remove datafields. Another solution could be to do the data transfer within BigQuery after the basic nomalization, using a stored SQL-Statement within BigQuery. But I would not be able to trigger this with airbyte and it has the same disadvantage as DBT regarding regular manual updates. I could also add another tool for the orchestration but this will also add more flexibility, that I would love to keep out of this fairly simple task. I have tried multiple Datatypes that could transport my MS SQL-Server Date information, but that changes nothing. Airbyte is recognizing the Field a date: ... column Posting Date (type datetime[23], nullable false) -> JsonSchemaType({type=string}) This seems like a very common requirement to me so I do really hope there is a simple solution to this. #tldr: Is there a way to tell the MS SQL-Server Connector that I would really like it to add the correct format-label "date-time" to a string containig a date?
m
I have the same "problem", but I'm using dbt to solve it 🙂 Another solution would be to add a view on top of your tables in BQ, and give the users access to this view, not the base table. In the view you add the cast functions to get the correct datatype. Another option is Dataform, which is part of Google Cloud. It's like dbt, but integrated in the UI of BQ.
u
Thanks a lot for your reply @Magnus Fagertun. The view on top of the table in BQ is actually a brilliantly easy Idea! I think, I'll go that route. Seems there's still some work to do with the MSSQL connector. The Dataformat "Date" seems quite common to me. 😆
w
I dont think the JSON Schema validation format supports date types which is why they are converted to strings. The reason being is date type formatting is incredibly dependent on locale and preference, it is often best the end user knowledgeable of the dates handles the conversion. The view approach is how I typically conversions outside of DBT, it also helpful to safely allow downstream dependencies on the view rather than the direct table which may at some point change, and thus break code. With a view you can obfuscate the table itself.