Thread: Re : Am I overseen ?

Re : Am I overseen ?

From
Laurent ROCHE
Date:
Hi,

You might want to have a look at DdlUtils that does similar things that you want to do: compare databases schemas using XML files and synchronising the schemas.
Interesting tool ! !

http://db.apache.org/ddlutils/

 
Have fun,
L@u
The Computing Froggy


----- Message d'origine ----
De : Scott Marlowe <scott.marlowe@gmail.com>
À : Lothar Behrens <lothar.behrens@lollisoft.de>
Cc : pgsql-general@postgresql.org
Envoyé le : Jeudi, 18 Octobre 2007, 18h22mn 12s
Objet : Re: [GENERAL] Am I overseen ?

On 10/18/07, Lothar Behrens <lothar.behrens@lollisoft.de> wrote:
> On 18 Okt., 17:17, br...@zijn-digital.com (brian) wrote:
> > Lothar Behrens wrote:
> > > Hi,
> >
> > > Several groups I post most of them does not answer.
> > > Did noone see my postings ?
> >
> > > Please at least give me one answer :-)
> >
> > > Thanks, Lothar
> >
> > ping
> >
> > What was your query?
> >
>
> I do convert an UML XMI model to a database script to create the
> database schema.
> To enable multiple iterations I need conditional alter table add
> column like syntax.
>
> For sample:
>
> if not exsist column a in table b then
>  alter table b add a char(100);
>
> Is there any way to do this ?

What kind of tools are you familiar with?  I'm guessing you could
write something in perl or php to do it.  Or do you want to do it in
sql?  I'm sure you could do it in plpgsql or some other pl/language,
if you want it all in the db.

But I'm not that familiar with UML as to say what's the best approach.

Normally when you get thundering silence, you've asked a question no
one feels real qualified to answer, and rather than answer it halfway,
they just leave it for the next guy to get.

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org/



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

Re: Re : Am I overseen ?

From
Lothar Behrens
Date:
I think this is not the way I should go.


My application is a database prototype design tool that also is able
to run the design because the designer it self is a design.


So I did not only need a DDL to create the target application's
database, also I need to feed a model into the system database

that specifies the model at GUI level. (Data in general means)


Therefore I have choosen the XMI / XML / XSLT approach to get SQL
scripts at once.


When there is a way to optionally add columns to existing tables via
SQL I have very less development needs to get this working.

If I do read the XML model into a DOM tree or use extarnal tools I
probably have more to work on a solution.


But thanks, it may help somehow. I'll have a look.


Lothar


Am 18.10.2007 um 19:41 schrieb Laurent ROCHE:


<excerpt><fontfamily><param>Arial</param><x-tad-bigger>Hi,</x-tad-bigger></fontfamily>


<fontfamily><param>Arial</param><x-tad-bigger>You might want to have a
look at DdlUtils that does similar things that you want to do: compare
databases schemas using XML files and synchronising the schemas.</x-tad-bigger></fontfamily>

<fontfamily><param>Arial</param><x-tad-bigger>Interesting tool ! ! </x-tad-bigger></fontfamily>



<fontfamily><param>Arial</param><color><param>0000,0000,EEEE</param><x-tad-bigger>http://db.apache.org/ddlutils/</x-tad-bigger></color></fontfamily>


<fontfamily><param>Arial</param><x-tad-bigger> </x-tad-bigger></fontfamily>

<fontfamily><param>Arial</param><x-tad-bigger>Have fun,</x-tad-bigger></fontfamily>

<fontfamily><param>Arial</param><x-tad-bigger>L@u</x-tad-bigger></fontfamily>

<fontfamily><param>Arial</param><x-tad-bigger>The Computing Froggy</x-tad-bigger></fontfamily>



<fontfamily><param>Times New Roman</param><bigger><bigger>-----
Message d'origine ----</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>De : Scott
Marlowe <<scott.marlowe@gmail.com></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>À : Lothar
Behrens <<lothar.behrens@lollisoft.de></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>Cc :
pgsql-general@postgresql.org</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>Envoyé le :
Jeudi, 18 Octobre 2007, 18h22mn 12s</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>Objet : Re:
[GENERAL] Am I overseen ?</bigger></bigger></fontfamily>


<fontfamily><param>Times New Roman</param><bigger><bigger>On 10/18/07,
Lothar Behrens
<<<color><param>0000,0000,EEEE</param>lothar.behrens@lollisoft.de</color>>
wrote:</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> On 18
Okt., 17:17,
<color><param>0000,0000,EEEE</param>br...@zijn-digital.com</color> (brian)
wrote:</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> > Lothar
Behrens wrote:</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> > > Hi,</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> ></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> > >
Several groups I post most of them does not answer.</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> > > Did
noone see my postings ?</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> ></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> > > Please
at least give me one answer :-)</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> ></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> > >
Thanks, Lothar</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> ></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> > ping</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> ></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> > What was
your query?</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> ></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> I do
convert an UML XMI model to a database script to create the</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> database
schema.</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> To enable
multiple iterations I need conditional alter table add</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> column
like syntax.</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> For sample:</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> if not
exsist column a in table b then</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>>  alter
table b add a char(100);</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>></bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>> Is there
any way to do this ?</bigger></bigger></fontfamily>


<fontfamily><param>Times New Roman</param><bigger><bigger>What kind of
tools are you familiar with?  I'm guessing you could</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>write
something in perl or php to do it.  Or do you want to do it in</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>sql?  I'm
sure you could do it in plpgsql or some other pl/language,</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>if you want
it all in the db.</bigger></bigger></fontfamily>


<fontfamily><param>Times New Roman</param><bigger><bigger>But I'm not
that familiar with UML as to say what's the best approach.</bigger></bigger></fontfamily>


<fontfamily><param>Times New Roman</param><bigger><bigger>Normally
when you get thundering silence, you've asked a question no</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>one feels
real qualified to answer, and rather than answer it halfway,</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>they just
leave it for the next guy to get.</bigger></bigger></fontfamily>


<fontfamily><param>Times New Roman</param><bigger><bigger>---------------------------(end
of broadcast)---------------------------</bigger></bigger></fontfamily>

<fontfamily><param>Times New Roman</param><bigger><bigger>TIP 4: Have
you searched our list archives?</bigger></bigger></fontfamily>


<fontfamily><param>Times New Roman</param><bigger><bigger>           
  <color><param>0000,0000,EEEE</param>http://archives.postgresql.org/</color></bigger></bigger></fontfamily>



 Ne gardez plus qu'une seule adresse mail !
<color><param>0000,0000,EEEE</param>Copiez vos mails</color> vers
Yahoo! Mail

</excerpt>--

Lothar Behrens                |    Rapid Prototyping ...

Heinrich-Scheufelen-Platz 2        |

73252 Lenningen                  |    www.lollisoft.de



I think this is not the way I should go.

My application is a database prototype design tool that also is able to
run the design because the designer it self is a design.

So I did not only need a DDL to create the target application's
database, also I need to feed a model into the system database
that specifies the model at GUI level. (Data in general means)

Therefore I have choosen the XMI / XML / XSLT approach to get SQL
scripts at once.

When there is a way to optionally add columns to existing tables via
SQL I have very less development needs to get this working.
If I do read the XML model into a DOM tree or use extarnal tools I
probably have more to work on a solution.

But thanks, it may help somehow. I'll have a look.

Lothar

Am 18.10.2007 um 19:41 schrieb Laurent ROCHE:

> Hi,
>
> You might want to have a look at DdlUtils that does similar things
> that you want to do: compare databases schemas using XML files and
> synchronising the schemas.
> Interesting tool ! !
>
> http://db.apache.org/ddlutils/
>
>  
> Have fun,
> L@u
> The Computing Froggy
>
>
> ----- Message d'origine ----
> De : Scott Marlowe <scott.marlowe@gmail.com>
> À : Lothar Behrens <lothar.behrens@lollisoft.de>
> Cc : pgsql-general@postgresql.org
> Envoyé le : Jeudi, 18 Octobre 2007, 18h22mn 12s
> Objet : Re: [GENERAL] Am I overseen ?
>
> On 10/18/07, Lothar Behrens <lothar.behrens@lollisoft.de> wrote:
> > On 18 Okt., 17:17, br...@zijn-digital.com (brian) wrote:
> > > Lothar Behrens wrote:
> > > > Hi,
> > >
> > > > Several groups I post most of them does not answer.
> > > > Did noone see my postings ?
> > >
> > > > Please at least give me one answer :-)
> > >
> > > > Thanks, Lothar
> > >
> > > ping
> > >
> > > What was your query?
> > >
> >
> > I do convert an UML XMI model to a database script to create the
> > database schema.
> > To enable multiple iterations I need conditional alter table add
> > column like syntax.
> >
> > For sample:
> >
> > if not exsist column a in table b then
> >  alter table b add a char(100);
> >
> > Is there any way to do this ?
>
> What kind of tools are you familiar with?  I'm guessing you could
> write something in perl or php to do it.  Or do you want to do it in
> sql?  I'm sure you could do it in plpgsql or some other pl/language,
> if you want it all in the db.
>
> But I'm not that familiar with UML as to say what's the best approach.
>
> Normally when you get thundering silence, you've asked a question no
> one feels real qualified to answer, and rather than answer it halfway,
> they just leave it for the next guy to get.
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org/
>
>
>  Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers
> Yahoo! Mail
--
Lothar Behrens                |    Rapid Prototyping ...
Heinrich-Scheufelen-Platz 2        |
73252 Lenningen                  |    www.lollisoft.de



Re: Re : Am I overseen ?

From
Tom Lane
Date:
Lothar Behrens <lothar.behrens@lollisoft.de> writes:
> When there is a way to optionally add columns to existing tables via
> SQL I have very less development needs to get this working.

Why don't you just issue the ALTER ADD COLUMN and ignore the error
if it's duplicate column?

Or if you don't like that, it's not that hard to look into the system
catalogs and see if the column already exists.  A program bright enough
to be issuing dynamic DDL commands ought to be able to do that ...

            regards, tom lane