uploading tables
Posted in 2015
Topics: General Discussion
Hi, I need to upload some tables to a database. but some of them has foreing keys, so I need to check the estructure of these tables to know the order to I have to upload them. Is there a easier way to know the correct order to upload the tables on a database ?? Thanks in advance. --001a1147b3ae91ac35051a8c39c7
If you have myschema you can create a schema with the --dependency-order option and the tables will be listed in order of dependencies with parents before children. Art On Jul 10, 2015 5:41 PM, "jorge valenzuela" <jorgervt@gmail.com> wrote: > Hi, > > I need to upload some tables to a database. but some of them has foreing > keys, so I need > to check the estructure of these tables to know the order to I have to > upload them. > > Is there a easier way to know the correct order to upload the tables on a > database ?? > > Thanks in advance. > > --001a1147b3ae91ac35051a8c39c7 > > > > ******************************************************************************* > Forum Note: Use "Reply" to post a response in the discussion forum. > > --001a1140fee694997d051a8cad94
Art - would setting checks,constraints, etc. to DEFERRED have a similar effect? I know myschema would have a lot more flexibility and functions but have always wanted to ask. Thanks - Mark
Mark:
OK, so, yes, you could set all of the constraints to deferred during the
data load, however, they are only deferred until the transaction is
committed. That means that all of the tables would have to be loaded under
a single HUGE transaction which is likely to result in a long transaction
rollback. So, possible but not pretty. Much better to, as the OP asks,
load the tables in the correct order parents before children so that all
constraints will be satisfied and you can use smaller transactions - either
table by table or even subsets of the records as would happen if you used
my dbcopy or dbmove utilities to copy the data from another table/database
or used dbload or Jonathan Leffler's sqlreload utilities to load the data
from files.
The easiest way to get the correct ordering of the tables is to use
myschema --dependency-order to create an ordered schema and then use a
small awk or perl script to parse the output to create a data load script
(there are sample awk scripts to parse myschema/dbschema output in my
package utils4_ak that you can use as templates).
Art
Art S. Kagel, President and Principal Consultant
ASK Database Management
www.askdbmgt.com
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on the IIUG, nor any other organization with which I am
associated either explicitly, implicitly, or by inference. Neither do
those opinions reflect those of other individuals affiliated with any
entity with which I am affiliated nor those of the entities themselves.
On Mon, Jul 13, 2015 at 5:09 PM, MARK SCRANTON <mark@markscranton.com>
wrote:
> Art - would setting checks,constraints, etc. to DEFERRED have a similar
> effect? I know myschema would have a lot more flexibility and functions but
> have always wanted to ask.
>
> Thanks -
> Mark
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--001a113ee4fc48fa12051ac88022
Hmm, maybe my dbscript utility needs to be updates with a
--dependency-order option as well .... Thoughts for the next release.
Art
Art S. Kagel, President and Principal Consultant
ASK Database Management
www.askdbmgt.com
Blog: http://informix-myview.blogspot.com/
Disclaimer: Please keep in mind that my own opinions are my own opinions
and do not reflect on the IIUG, nor any other organization with which I am
associated either explicitly, implicitly, or by inference. Neither do
those opinions reflect those of other individuals affiliated with any
entity with which I am affiliated nor those of the entities themselves.
On Mon, Jul 13, 2015 at 5:34 PM, Art Kagel <art.kagel@gmail.com> wrote:
> Mark:
>
> OK, so, yes, you could set all of the constraints to deferred during the
> data load, however, they are only deferred until the transaction is
> committed. That means that all of the tables would have to be loaded under
> a single HUGE transaction which is likely to result in a long transaction
> rollback. So, possible but not pretty. Much better to, as the OP asks,
> load the tables in the correct order parents before children so that all
> constraints will be satisfied and you can use smaller transactions - either
> table by table or even subsets of the records as would happen if you used
> my dbcopy or dbmove utilities to copy the data from another table/database
> or used dbload or Jonathan Leffler's sqlreload utilities to load the data
> from files.
>
> The easiest way to get the correct ordering of the tables is to use
> myschema --dependency-order to create an ordered schema and then use a
> small awk or perl script to parse the output to create a data load script
> (there are sample awk scripts to parse myschema/dbschema output in my
> package utils4_ak that you can use as templates).
>
> Art
>
> Art S. Kagel, President and Principal Consultant
> ASK Database Management
> www.askdbmgt.com
>
> Blog: http://informix-myview.blogspot.com/
>
> Disclaimer: Please keep in mind that my own opinions are my own opinions
> and do not reflect on the IIUG, nor any other organization with which I am
> associated either explicitly, implicitly, or by inference. Neither do
> those opinions reflect those of other individuals affiliated with any
> entity with which I am affiliated nor those of the entities themselves.
>
>
> On Mon, Jul 13, 2015 at 5:09 PM, MARK SCRANTON <mark@markscranton.com>
> wrote:
>
>> Art - would setting checks,constraints, etc. to DEFERRED have a similar
>> effect? I know myschema would have a lot more flexibility and functions
>> but
>> have always wanted to ask.
>>
>> Thanks -
>> Mark
>>
>>
>>
>>
*******************************************************************************
>> Forum Note: Use "Reply" to post a response in the discussion forum.
>>
>>
>
--089e01183c9224f4a8051ac88584