[Phpmyadmin-devel] [Fwd: csv -> mysql]

Michal Čihař michal at cihar.com
Mon Jun 12 10:56:59 CEST 2006


On Mon, 12 Jun 2006 09:59:20 +0200
Sebastian Mendel <lists at sebastianmendel.de> wrote:

> in english: is it possible to automatically create a table from CSV
> file? in other words: auto detect field type by content?

IMHO it could be possible, however there could be several problems:

- what length should be char fields? text or varchar?

- detecting field type from whole file can take very long, so you need
to scan only few lines and then somehow handle error when your
expectation fails later

We might simply choose to import everything to text fields and then
let MySQL create 'optimal' structure by SELECT * FROM `table`
PROCEDURE ANALYSE (). But it tends to create ENUMs for small set of

	Michal Čihař | http://cihar.com | http://blog.cihar.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20060612/e51d91d5/attachment.sig>

More information about the Developers mailing list