How do I easily create the DDL statements for a schema represented by the contents of an XML file?Computer...

Is it possible to map from a parameter to a trajectory?

How can guns be countered by melee combat without raw-ability or exceptional explanations?

Can I legally make a website about boycotting a certain company?

If I tried and failed to start my own business, how do I apply for a job without job experience?

Is "accuse people to be racist" grammatical?

How do I avoid the "chosen hero" feeling?

Why "rm -r" is unable to delete this folder?

Why does a single AND gate need 60 transistors?

Sing Baby Shark

What if I miss a connection and don't have money to book next flight?

How can I differentiate duration vs starting time

How would an EMP effect spacesuits (and small-arms weapons)?

How to deal with an underperforming subordinate?

Including proofs of known theorems in master's thesis

Can you say "leftside right"?

How can I prevent an oracle who can see into the past from knowing everything that has happened?

What happened to Hermione’s clothing and other possessions after she wiped her parents’ memories of her?

Would water spill from a bowl in a Bag of Holding?

How do I add a strong "onion flavor" to the biryani (in restaurant style)?

In the Lost in Space intro why was Dr. Smith actor listed as a special guest star?

How to know if I am a 'Real Developer'

Taking an academic pseudonym?

Is there a way to pause a running process on Linux systems and resume later?

Calculating the strength of an ionic bond that contains poly-atomic ions



How do I easily create the DDL statements for a schema represented by the contents of an XML file?


Computer restarted and Postgres 9.2 service cannot be started?Is there a Postgres admin GUI that can execute a master file containing multiple sql filesWhat must be in place to validate a XMLTYPE against a schema?Why is Postgres on 64-bit CentOS 6 significantly slower than Postgres on 32-bit CentOS 6Help with SQL Server and XML columnsTransfer of data (lots) from NAS based MariaDB to Postgres at AWSIs my DB design alright or not?Optimizing Slow Changing Dimension (SCD2) joinsXML/SQL Server 2008 Error: XQuery…Cannot implicitly atomize or apply 'fn:data()' to complex content elementsHow to split XML array into separate rows (while upholding consistency)













0















I have been given an xml file and it's pretty obvious in looking at the contents that it contains an inherent schema. What I'd like to do is run a program against it that outputs the schema represented by the contents, then create said schema in / as a database (in Postgres), and then populate said database so I can run SQL queries against the data.



I figured that this has to be a commonly desired capability, but I've never needed to do this before and am not sure what already exists.



I work in Postgres, and it has many XML related tools, so I figure that's a good place to look but so far haven't found it.



Added information:



Doing some digging, I found that the people who gave us the xml file also have an "xml schema file" that matches, and I've gotten a copy. It's on the web here for those that care.)



OK, so step one was satisfied; get to an "xml schema."



Now I need to convert that into an SQL schema...










share|improve this question
















bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • You might like to look here - possibly Oracle specific (mentions PL/SQL) - but, hey, that's F/LOSS for you :-)

    – Vérace
    Nov 18 '16 at 19:34













  • You will need to write a XSLT transformation that changes the XML (that you did not show us) to a SQL script that creates the tables

    – a_horse_with_no_name
    Nov 18 '16 at 22:48
















0















I have been given an xml file and it's pretty obvious in looking at the contents that it contains an inherent schema. What I'd like to do is run a program against it that outputs the schema represented by the contents, then create said schema in / as a database (in Postgres), and then populate said database so I can run SQL queries against the data.



I figured that this has to be a commonly desired capability, but I've never needed to do this before and am not sure what already exists.



I work in Postgres, and it has many XML related tools, so I figure that's a good place to look but so far haven't found it.



Added information:



Doing some digging, I found that the people who gave us the xml file also have an "xml schema file" that matches, and I've gotten a copy. It's on the web here for those that care.)



OK, so step one was satisfied; get to an "xml schema."



Now I need to convert that into an SQL schema...










share|improve this question
















bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • You might like to look here - possibly Oracle specific (mentions PL/SQL) - but, hey, that's F/LOSS for you :-)

    – Vérace
    Nov 18 '16 at 19:34













  • You will need to write a XSLT transformation that changes the XML (that you did not show us) to a SQL script that creates the tables

    – a_horse_with_no_name
    Nov 18 '16 at 22:48














0












0








0


1






I have been given an xml file and it's pretty obvious in looking at the contents that it contains an inherent schema. What I'd like to do is run a program against it that outputs the schema represented by the contents, then create said schema in / as a database (in Postgres), and then populate said database so I can run SQL queries against the data.



I figured that this has to be a commonly desired capability, but I've never needed to do this before and am not sure what already exists.



I work in Postgres, and it has many XML related tools, so I figure that's a good place to look but so far haven't found it.



Added information:



Doing some digging, I found that the people who gave us the xml file also have an "xml schema file" that matches, and I've gotten a copy. It's on the web here for those that care.)



OK, so step one was satisfied; get to an "xml schema."



Now I need to convert that into an SQL schema...










share|improve this question
















I have been given an xml file and it's pretty obvious in looking at the contents that it contains an inherent schema. What I'd like to do is run a program against it that outputs the schema represented by the contents, then create said schema in / as a database (in Postgres), and then populate said database so I can run SQL queries against the data.



I figured that this has to be a commonly desired capability, but I've never needed to do this before and am not sure what already exists.



I work in Postgres, and it has many XML related tools, so I figure that's a good place to look but so far haven't found it.



Added information:



Doing some digging, I found that the people who gave us the xml file also have an "xml schema file" that matches, and I've gotten a copy. It's on the web here for those that care.)



OK, so step one was satisfied; get to an "xml schema."



Now I need to convert that into an SQL schema...







postgresql schema xml






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '16 at 0:11







Richard T

















asked Nov 18 '16 at 19:10









Richard TRichard T

1914




1914





bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 12 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • You might like to look here - possibly Oracle specific (mentions PL/SQL) - but, hey, that's F/LOSS for you :-)

    – Vérace
    Nov 18 '16 at 19:34













  • You will need to write a XSLT transformation that changes the XML (that you did not show us) to a SQL script that creates the tables

    – a_horse_with_no_name
    Nov 18 '16 at 22:48



















  • You might like to look here - possibly Oracle specific (mentions PL/SQL) - but, hey, that's F/LOSS for you :-)

    – Vérace
    Nov 18 '16 at 19:34













  • You will need to write a XSLT transformation that changes the XML (that you did not show us) to a SQL script that creates the tables

    – a_horse_with_no_name
    Nov 18 '16 at 22:48

















You might like to look here - possibly Oracle specific (mentions PL/SQL) - but, hey, that's F/LOSS for you :-)

– Vérace
Nov 18 '16 at 19:34







You might like to look here - possibly Oracle specific (mentions PL/SQL) - but, hey, that's F/LOSS for you :-)

– Vérace
Nov 18 '16 at 19:34















You will need to write a XSLT transformation that changes the XML (that you did not show us) to a SQL script that creates the tables

– a_horse_with_no_name
Nov 18 '16 at 22:48





You will need to write a XSLT transformation that changes the XML (that you did not show us) to a SQL script that creates the tables

– a_horse_with_no_name
Nov 18 '16 at 22:48










1 Answer
1






active

oldest

votes


















0














have a look at liquibase - it's a great tool, and sounds like what you are looking for.
You could use it to create SQL statements using the updateSQL command or apply changes directly to the DB.



for example:



java -jar liquibase.jar 
--driver=oracle.jdbc.OracleDriver
--classpath=jdbcdriver.jar
--url=jdbc:oracle:thin:@localhost:1521:oracle
--username=scott
--password=tiger
updateSQL > /tmp/script.sql


will output the required changes to the scripts.sql file.



It supports many db servers including Postgres, and you can model your schema in XML, JSON or any way you like.

See: XML changeset



<changeSet id="1" author="nvoxland">
<createTable tableName="person">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="firstname" type="varchar(50)"/>
<column name="lastname" type="varchar(50)">
<constraints nullable="false"/>
</column>
<column name="state" type="char(2)"/>
</createTable>
</changeSet>


It's open source and actively maintained.



We've been using it on multiple projects and dbs - highly recommended :)






share|improve this answer


























  • Thanks for the tip. ...I've been scratching my head with this for some time... I don't see any commands to do this; can you please be more specific? This looks like it's a source code management tool for database schemas - didn't see anything about XML in there!

    – Richard T
    Nov 19 '16 at 23:30













  • You can run it directly against your db - skipping SQL. Or use the updateSQL command - I'll update with a sample when I'm near a Computer... see: liquibase.org/documentation/maven/maven_updatesql.html

    – cohenjo
    Nov 20 '16 at 4:33











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f155729%2fhow-do-i-easily-create-the-ddl-statements-for-a-schema-represented-by-the-conten%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














have a look at liquibase - it's a great tool, and sounds like what you are looking for.
You could use it to create SQL statements using the updateSQL command or apply changes directly to the DB.



for example:



java -jar liquibase.jar 
--driver=oracle.jdbc.OracleDriver
--classpath=jdbcdriver.jar
--url=jdbc:oracle:thin:@localhost:1521:oracle
--username=scott
--password=tiger
updateSQL > /tmp/script.sql


will output the required changes to the scripts.sql file.



It supports many db servers including Postgres, and you can model your schema in XML, JSON or any way you like.

See: XML changeset



<changeSet id="1" author="nvoxland">
<createTable tableName="person">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="firstname" type="varchar(50)"/>
<column name="lastname" type="varchar(50)">
<constraints nullable="false"/>
</column>
<column name="state" type="char(2)"/>
</createTable>
</changeSet>


It's open source and actively maintained.



We've been using it on multiple projects and dbs - highly recommended :)






share|improve this answer


























  • Thanks for the tip. ...I've been scratching my head with this for some time... I don't see any commands to do this; can you please be more specific? This looks like it's a source code management tool for database schemas - didn't see anything about XML in there!

    – Richard T
    Nov 19 '16 at 23:30













  • You can run it directly against your db - skipping SQL. Or use the updateSQL command - I'll update with a sample when I'm near a Computer... see: liquibase.org/documentation/maven/maven_updatesql.html

    – cohenjo
    Nov 20 '16 at 4:33
















0














have a look at liquibase - it's a great tool, and sounds like what you are looking for.
You could use it to create SQL statements using the updateSQL command or apply changes directly to the DB.



for example:



java -jar liquibase.jar 
--driver=oracle.jdbc.OracleDriver
--classpath=jdbcdriver.jar
--url=jdbc:oracle:thin:@localhost:1521:oracle
--username=scott
--password=tiger
updateSQL > /tmp/script.sql


will output the required changes to the scripts.sql file.



It supports many db servers including Postgres, and you can model your schema in XML, JSON or any way you like.

See: XML changeset



<changeSet id="1" author="nvoxland">
<createTable tableName="person">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="firstname" type="varchar(50)"/>
<column name="lastname" type="varchar(50)">
<constraints nullable="false"/>
</column>
<column name="state" type="char(2)"/>
</createTable>
</changeSet>


It's open source and actively maintained.



We've been using it on multiple projects and dbs - highly recommended :)






share|improve this answer


























  • Thanks for the tip. ...I've been scratching my head with this for some time... I don't see any commands to do this; can you please be more specific? This looks like it's a source code management tool for database schemas - didn't see anything about XML in there!

    – Richard T
    Nov 19 '16 at 23:30













  • You can run it directly against your db - skipping SQL. Or use the updateSQL command - I'll update with a sample when I'm near a Computer... see: liquibase.org/documentation/maven/maven_updatesql.html

    – cohenjo
    Nov 20 '16 at 4:33














0












0








0







have a look at liquibase - it's a great tool, and sounds like what you are looking for.
You could use it to create SQL statements using the updateSQL command or apply changes directly to the DB.



for example:



java -jar liquibase.jar 
--driver=oracle.jdbc.OracleDriver
--classpath=jdbcdriver.jar
--url=jdbc:oracle:thin:@localhost:1521:oracle
--username=scott
--password=tiger
updateSQL > /tmp/script.sql


will output the required changes to the scripts.sql file.



It supports many db servers including Postgres, and you can model your schema in XML, JSON or any way you like.

See: XML changeset



<changeSet id="1" author="nvoxland">
<createTable tableName="person">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="firstname" type="varchar(50)"/>
<column name="lastname" type="varchar(50)">
<constraints nullable="false"/>
</column>
<column name="state" type="char(2)"/>
</createTable>
</changeSet>


It's open source and actively maintained.



We've been using it on multiple projects and dbs - highly recommended :)






share|improve this answer















have a look at liquibase - it's a great tool, and sounds like what you are looking for.
You could use it to create SQL statements using the updateSQL command or apply changes directly to the DB.



for example:



java -jar liquibase.jar 
--driver=oracle.jdbc.OracleDriver
--classpath=jdbcdriver.jar
--url=jdbc:oracle:thin:@localhost:1521:oracle
--username=scott
--password=tiger
updateSQL > /tmp/script.sql


will output the required changes to the scripts.sql file.



It supports many db servers including Postgres, and you can model your schema in XML, JSON or any way you like.

See: XML changeset



<changeSet id="1" author="nvoxland">
<createTable tableName="person">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" nullable="false"/>
</column>
<column name="firstname" type="varchar(50)"/>
<column name="lastname" type="varchar(50)">
<constraints nullable="false"/>
</column>
<column name="state" type="char(2)"/>
</createTable>
</changeSet>


It's open source and actively maintained.



We've been using it on multiple projects and dbs - highly recommended :)







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 20 '16 at 8:41

























answered Nov 19 '16 at 19:19









cohenjocohenjo

81025




81025













  • Thanks for the tip. ...I've been scratching my head with this for some time... I don't see any commands to do this; can you please be more specific? This looks like it's a source code management tool for database schemas - didn't see anything about XML in there!

    – Richard T
    Nov 19 '16 at 23:30













  • You can run it directly against your db - skipping SQL. Or use the updateSQL command - I'll update with a sample when I'm near a Computer... see: liquibase.org/documentation/maven/maven_updatesql.html

    – cohenjo
    Nov 20 '16 at 4:33



















  • Thanks for the tip. ...I've been scratching my head with this for some time... I don't see any commands to do this; can you please be more specific? This looks like it's a source code management tool for database schemas - didn't see anything about XML in there!

    – Richard T
    Nov 19 '16 at 23:30













  • You can run it directly against your db - skipping SQL. Or use the updateSQL command - I'll update with a sample when I'm near a Computer... see: liquibase.org/documentation/maven/maven_updatesql.html

    – cohenjo
    Nov 20 '16 at 4:33

















Thanks for the tip. ...I've been scratching my head with this for some time... I don't see any commands to do this; can you please be more specific? This looks like it's a source code management tool for database schemas - didn't see anything about XML in there!

– Richard T
Nov 19 '16 at 23:30







Thanks for the tip. ...I've been scratching my head with this for some time... I don't see any commands to do this; can you please be more specific? This looks like it's a source code management tool for database schemas - didn't see anything about XML in there!

– Richard T
Nov 19 '16 at 23:30















You can run it directly against your db - skipping SQL. Or use the updateSQL command - I'll update with a sample when I'm near a Computer... see: liquibase.org/documentation/maven/maven_updatesql.html

– cohenjo
Nov 20 '16 at 4:33





You can run it directly against your db - skipping SQL. Or use the updateSQL command - I'll update with a sample when I'm near a Computer... see: liquibase.org/documentation/maven/maven_updatesql.html

– cohenjo
Nov 20 '16 at 4:33


















draft saved

draft discarded




















































Thanks for contributing an answer to Database Administrators Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f155729%2fhow-do-i-easily-create-the-ddl-statements-for-a-schema-represented-by-the-conten%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Szabolcs (Ungheria) Altri progetti | Menu di navigazione48°10′14.56″N 21°29′33.14″E /...

Discografia di Klaus Schulze Indice Album in studio | Album dal vivo | Singoli | Antologie | Colonne...

How to make inet_server_addr() return localhost in spite of ::1/128RETURN NEXT in Postgres FunctionConnect to...