I\'d like to pull a table\'s field names from MySql into python, and I know that
\'show columns from project\'
will work. And I\'ve read that
If your goal is a comma-delimited list (Not very Python literate, but that's mostly what you'd want in PHP and Perl) GROUP_CONCAT is your friend:
SELECT GROUP_CONCAT(column_name) FROM information_schema.columns WHERE table_name='your-table-name-here' GROUP BY TABLE_NAME ORDER BY ORDINAL_POSITION
If you need them quoted this gives you all EXCEPT the outermost quotes:
SELECT GROUP_CONCAT(column_name SEPARATOR '","') FROM information_schema.columns WHERE table_name='your-table-name-here' GROUP BY TABLE_NAME ORDER BY ORDINAL_POSITION