chrthomsen / pygrametl

Official repository for pygrametl - ETL programming in Python
http://pygrametl.org
BSD 2-Clause "Simplified" License
289 stars 41 forks source link

Fix BatchFactTable not converting all None to NULL #51

Closed skejserjensen closed 2 years ago

skejserjensen commented 2 years ago

As described in GitHub issue #50 the current implementation of BatchFactTable cannot insert rows containing NULL values if usemultirow=True (the default is False). This PR adds the function getsqlfriendlystr() which converts values to strings that can be used in an SQL expression. It currently converts None to "NULL", encapsulates strings in single quotes, escapes all single quotes in strings by doubling them, and converts the remaining values to strings using str(). The PR also replaces BatchFactTable's internal value to string conversation logic with a call to getsqlfriendlystr().