Thank you for adding the “Import from SQL” feature ( https://mockaroo.com/schemas/create_from_ddl ) - I saw in the original forum-thread ( Data based on imported schema ) that it’s based on Postgres, unfortunately I’m working in an MSSQL/T-SQL project so I get a lot of “Error: could not parse create table statement.” messages and it’s unclear what part of my
CREATE TABLE statement is breaking it.
I’d like to suggest the following:
- As a quick-fix, can you add a paragraph at the top of the page that lists the SQL syntaxes and data-type-names supported, so we don’t have to hunt the forums. And better yet: a
<table>listing the known data-types.
- Can you have it try to generate a Mockaroo schema whenever the textarea content changes (i.e. a live preview)?
- When there is an error, to list which line caused the problem, including the column-name if possible (this could be done with a simple regex).
- And eventually, support for selecting a specific SQL dialect from a drop-down list would be nice as well. e.g. how T-SQL uses square-brackets, MySQL uses backticks, and PostgreSQL uses double-quotes for escaped names.
After some fiddling, I saw that it breaks if square-brackets are used for escaping column-names. So this doesn’t work:
CREATE TABLE dbo.People ( PersonId int NOT NULL, [Name] nvarchar(50) NOT NULL )
but this does (even though
Name is also a keyword in Postgres, albeit a non-reserved keyword):
CREATE TABLE dbo.People ( PersonId int NOT NULL, Name nvarchar(50) NOT NULL )
So as another quick-fix, can you add a note that instructs users to convert
"name"? Or preprocess the input to convert square-bracketed names to double-quotes?