Search code examples
sqlcsvddldelimited

Generate DDL SQL create table statement after scanning CSV file


Are there any command line tools (Linux, Mac, and/or Windows) that I could use to scan a delimited file and output a DDL create table statement with the data type determined for me?

Did some googling, but couldn't find anything. Was wondering if others might know, thanks!


Solution

  • DDL-generator can do this. It can generate DDL's for YAML, JSON, CSV, Pickle and HTML (although I don't know how the last one works). I just tried it on some data exported from Salesforce and it worked pretty well. Note you need to use it with Python 3, I could not get it to work with Python 2.7.