Impoved version which doesn't require specifying data types - it samples the schema.