Discussions
Categories
- 196.9K All Categories
- 2.2K Data
- 239 Big Data Appliance
- 1.9K Data Science
- 450.4K Databases
- 221.7K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 31 Multilingual Engine
- 550 MySQL Community Space
- 478 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3K ORDS, SODA & JSON in the Database
- 546 SQLcl
- 4K SQL Developer Data Modeler
- 187.1K SQL & PL/SQL
- 21.3K SQL Developer
- 295.9K Development
- 17 Developer Projects
- 138 Programming Languages
- 292.6K Development Tools
- 107 DevOps
- 3.1K QA/Testing
- 646K Java
- 28 Java Learning Subscription
- 37K Database Connectivity
- 155 Java Community Process
- 105 Java 25
- 22.1K Java APIs
- 138.1K Java Development Tools
- 165.3K Java EE (Java Enterprise Edition)
- 18 Java Essentials
- 160 Java 8 Questions
- 86K Java Programming
- 80 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 204 Java User Groups
- 24 JavaScript - Nashorn
- Programs
- 443 LiveLabs
- 38 Workshops
- 10.2K Software
- 6.7K Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 171 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 232 Portuguese
How to suppress schema in liquibase genobject/genschema output?
Sqlcl liquibase genobject and genschema include the schema in the object definitions and references. How can I suppress this?
E.g.
lb genobject -type table -name address
yields
<changeSet id="3fd0a442e9c1114948de539f2f334845800bdc65" author="Generated" failOnError="false" >
<n0:createSxmlObject objectName="ADDRESS" objectType="table" ownerName="CSTDEV" >
<n0:source><![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?><TABLE xmlns="http://xmlns.oracle.com/ku" version="1.0">
<SCHEMA>CSTDEV</SCHEMA>
<NAME>ADDRESS</NAME>
<RELATIONAL_TABLE>
I'd prefer this without the <SCHEMA> definition since we deploy to several different schemas. This seems like a bug given the presence of the -emit_schema option.
I've tried 'set ddl emit_schema off' but that doesn't work either. I get this in 19.4 and 20.2.
Any ideas?
Answers
-
That is expected behavior.
Approach the "issue" the other way round, when you deploy the change to the target schema by using "lb update xmlfile.xml false" as the documentation states
5. Create the object in the current schema. Note: As the schema name has changed, you must set include schema to
false
or it will try and create the object in the HR schema. -
Our pipeline uses liquibase directly, so this isn’t available to me. I’ve been using liquibase much longer than SQLcl. Including the schema in source control generates confusing noise in a multi-schema dev environment. This is also contrary to the behaviour the existing SQLcl DDL command, the DMBS_METADATA package (which we already use), and the docs on the -emit_schema command line option.
Nice start, but this is needlessly different from our existing practice and the behaviour of the existing tools. The only value here for us was avoiding having to write a query to order the table ddls for constraint dependencies, but SO solved that for me yesterday, and I’ve moved on. If "sqlcl ddl schema” existed, I’d wouldn’t have looked at genschema. My team is much more comfortable with sql text.
Thanks for the suggestion. Pass.
-
There is a bug, the -emit schema flag wasn't intended to be included/supported for the genschema command, only on updates.
-
>> If "sqlcl ddl schema” existed
You can make that happen with a bit of js and and SCRIPT command - basically loop through the contents of user_objects and feed it to the DDL command, throw in a spool.