List Info

Thread: Re : Export data from alternate schema




Re : Export data from alternate schema
country flaguser name
United States
2007-09-18 12:35:59
Hi Tom (and All),

I eventually found the problem it's in the Database object created by writeDataToXML(Platform platform, DataWriter writer).
(line 361 in DatabaseDataIO.java)

I am including my correction: feel free to use and/or review/correct it.
I realise it's not perfect (more like an ugly patch) but it works for me and I have noticed (from the deprecated comments] there are plans for a better schema implementation.

Tom, feel free to contact me off list for a chat about this if needed.

 
Have fun,
Lu
The Computing Froggy


----- Message d'origine ----
De : Laurent ROCHE <laurent_rocheyahoo.com&gt;
À : ddlutils-userdb.apache.org
Envoyé le : Mardi, 18 Septembre 2007, 11h56mn 49s
Objet&nbsp;: Export data from alternate schema [Was: Re : schema mix up !]

Hi,

I am still not managing to export data from tables on a schema other than public.
To avoid conflicts I have renamed the tables in xfrt_synch schema so now the writeDataToFile task does not fail anymore ... but it does not export the tables from xfrt_synch schema it exports tables from schema public.

The writeSchemaToFile though works well and export the tables definition from xfrt_synch schema.

Did anyone manage to make the writeDataToFile task to work with schemas ?

 
Cheers,
Lu
The Computing Froggy


----- Message d'origine ----
De : Laurent ROCHE <laurent_rocheyahoo.com&gt;
À : ddlutils-userdb.apache.org
Cc : tomdzkgmail.com
Envoyé le : Lundi, 17 Septembre 2007, 18h49mn 32s
Objet&nbsp;: Re: schema mix up !

Tom,

I have tryed to get this working (exporting data using schemas) with no joy.

Here is the extract of biuld.xml defining the ant task
<target name="export-xfrt-data" description="Dumps db structure and data">
  ; &nbsp; &nbsp;<taskdef name="databaseToDdl"
  ; &nbsp; &nbsp; &nbsp; &nbsp;   ; classname="org.apache.ddlutils.task.DatabaseToDdlTask">
  ; &nbsp; &nbsp; &nbsp; <classpath refid="classpath"/>;
 &nbsp; &nbsp; &nbsp;</taskdef>

 &nbsp; &nbsp; &nbsp;<databaseToDdl modelName="fims_testsmall_land" sortforeignkeys="false" &nbsp;verbosity="DEBUG" schemapattern="xfrt%">
   ; &nbsp; &nbsp;  <database url="jdbc:postgresql://my_server/my_db"
&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; driverClassName="org.postgresql.Driver"
&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp; username="postgres"
&nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ;  password="XXXX"/>

 &nbsp; &nbsp; &nbsp; &nbsp; <writeSchemaToFile outputFile="schema_xfrt.xml" />
&nbsp; &nbsp; &nbsp; &nbsp;  <writeDataToFile outputFile="data_xfrt.xml" determineschema="true"/>
&nbsp; &nbsp; &nbsp; &lt;/databaseToDdl>
</target>

I get the following messages:
>ant export-xfrt-data
Buildfile: build.xml

export-xfrt-data:
[databaseToDdl] Borrowed connection org.apache.commons.dbcp.PoolableConnectiona761fe from data source
[databaseToDdl] Returning connection org.apache.commons.dbcp.PoolableConnectiona761fe to data source.
[databaseToDdl] Remaining connections: None

BUILD FAILED
C:appsDdlutils-testbuild.xml:130: Could not read the schema from the specified database: There are multiple column wi
th the name role_id in the table app_roles

Total time: 7 seconds
&gt;

I must do something wrong ... but I can not find out what ? ! ?
I have 2 schemas on my database (containing tables with identical names): xfrt_synch and public !


Cheers,
Lu
PS: I am following up an old thread !



----- Message d'origine ----
De : Thomas Dudziak <tomdzkgmail.com&gt;
� : ddlutils-userdb.apache.org
Envoy� le : Mardi, 2 Janvier 2007, 4h24mn 00s
Objet : Re: schema mix up !

On 12/26/06, Laurent ROCHE <laurent_rocheyahoo.com&gt; wrote:

&gt; There is a little problem when doing an export of a PostgreSQL database where there is
two schema (say public and queries).
>
> The generation of schema.xml is OK.
>
&gt; But when generating data.xml DDL Utils will fail as it will try to read the content of
tab1 in QUERIES with the SQL:
> select * from tab1
> instead of
> select * from queries.tab1

Please update DdlUtils and use both the schemapattern parameter
(http://db.apache.org/ddlutils/ant/org.apache.ddlutils.task.DatabaseToDdlTask.html#parameter-schemapattern)
and also set the new determineschema parameter to true
(http://db.apache.org/ddlutils/ant/org.apache.ddlutils.task.WriteDataToFileCommand.html#parameter-determineschema)

Tom

Have fun,
Lu
The Computing Froggy




 &nbsp; &nbsp; &nbsp;______________________________________________________________________________
Stockage illimité de vos mails avec Yahoo! Mail. Changez aujourd'hui de mail !



Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail



Stockage illimité de vos mails avec Yahoo! Mail. Changez aujourd'hui de mail !
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )