[Phpmyadmin-devel] Sql export feature for queries

Smita kumarismita62 at gmail.com
Fri Aug 15 20:23:24 CEST 2014


On Fri, Aug 15, 2014 at 3:46 PM, Chirayu Chiripal <
chirayu.chiripal at gmail.com> wrote:

> On Fri, Aug 15, 2014 at 1:24 PM, Smita <kumarismita62 at gmail.com> wrote:
>
>> Hi,
>>
>> I came across the bug #4444
>> <http://sourceforge.net/p/phpmyadmin/bugs/4444/> related to export
>> feature for queries.
>> I'm not sure how exactly this feature is supposed to behave if we are
>> exporting rows with some but not all columns and also in case we have
>> aliases and even when we have join queries.
>>
>
> We don't have to worry about aliases of table/column names here, just
> insert queries should get generated with original names and column selected
> in query. Create table can have complete table structure.
>
>

>> Assume we have tables:
>> actor (actor_id, first_name, last_name, city_id) with actor_id as primary
>> key.
>> address (address_id, adress, city_id, city_id, district, postal_code,
>> phone) with address_id as primary key and phone have not null unique
>> constraints.
>>
>> 1. when we select some but not all columns ex,
>> Select address_id, address from address:
>> when exported few of the rows, it have create table statement for table
>> 'address' with all the original columns not just these two. and data from
>> just these two columns in the Insert statements. so here when the same
>> exported file, we wish to import back will not work as phone have unique
>> constraint and we are not inserting the phone values.
>> Also If user is seeing just two of the columns in the table structure at
>> screen so they might be doing export thinking that it will be exporting the
>> same structure as on the screen.
>>
>
> I remember a discussion over this with Madhura. See
> https://sourceforge.net/p/phpmyadmin/bugs/4443/
>
>
>> 2. When we have aliases in column names:
>> ex: select actor_id, first_name as fname from actor;
>> So when we export few of the resultant rows, should the create table
>> statement have a column name first_name or fname ?. As I think of it,  It
>> should be fname, if user have in mind that he is exporting the structure of
>> the table he is looking at screen.
>>
>>
>> 3. When we have alias in table names:
>> The name of the table in create statement should be alias name or
>> original table name?
>>
>
> For 2nd and 3rd questions, This feature is implemented and will be present
> in 4.3. See RFE #755 & RFE #759.
>
>
Hi Chirayu
Thanks. I was testing with QA_4_2 branch. point 2,3 seems to working on
current master.

>
>> 4. When we have JOIN queries with more than one tables:
>>  ex:
>> SELECT * FROM (SELECT actor_id FROM actor as e INNER JOIN address as g on
>> e.actor_id = g.city_id) as t1
>> Currently if we try to export some rows from the above query, it export
>> nothing it goes on edit sql screen.
>>
>
> I also remember one discussion over this with Marc. I am quoting his reply
> here "exporting a join query makes no sense to me". Also see bug #4445.
>
> In that case, When we have results from Join query we should not show the
'export' option link. what you think ?

- Smita

>
>> Please share your thoughts.
>>
>> Thanks and Regards
>> - Smita
>>
>
> --
> Regards,
> Chirayu Chiripal
> phpMyAdmin Intern - Google Summer of Code 2014
> https://chirayuchiripal.wordpress.com/
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Phpmyadmin-devel mailing list
> Phpmyadmin-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20140815/d5e0c28e/attachment.html>


More information about the Developers mailing list