Skip to content

Acxiom/model-citizen

Repository files navigation

MODEL-CITIZEN

I am the very model of modern meta generable

Master Build Master Coverage Develop Build Develop Coverage

Export Oracle Data Modeler files as json and or SQL DDL for easier consumption by other processes.


Description

This tool was developed to feed downstream continuous integration processes (like join-hero) using objects modeled by the graphical tool Oracle SQL Developer Data Modeler. It was created to support version 18.2 of Oracle SQL Developer Data Modeler and Oracle Database 12c export type, primarily focused on tables, indexes and foreign keys. Your milage may vary for other targets and Data Modeler versions.

Installation

Installing may require elevated privileges. If you want to run without installing, see Run Without Installing. The following commands that reference '.' should be executed from the same folder in which this README file can be found.

Docker

Build

docker build -t model-citizen .

Run

# Print version info
docker run model-citizen --version

See the official Docker documentation for more details. In particular, using volumes will be handy so the container can interact with the native filesystem.

# Mount local filesystem and use in the container
docker run -it -v 'Z:\MY_COOL_MODELS\JJJ_DataModel\JJJ:/mnt/mydatamodel' model-citizen -i /mnt/mydatamodel/ -o /mnt/mydatamodel/model-citizen-out.ddl

Native

Note for Windows Users

This application requires Perl to be installed and on your path. Active Perl is one alternative for installing a Perl interpreter.

If you have chocolatey installed, you can use the following command to install Active Perl.

choco install activeperl

Install using cpanm

cpanm is the easiest and most modern way to install. If you don't have cpanm on your path, check out Installing cpanm

Using git repository directly
Github

Install directly from a github repository.

cpanm git://github.com/Acxiom/model-citizen.git

By default it will install the Master branch version. If you want another version, you can specify with the @ symbol after the URL.

# Install the current development build
cpanm git://github.com/Acxiom/model-citizen.git@develop

Video showing cpanm github install example.

Generic Repository

If this code repo is in BitBucket / Stash / Gitlab etc, you can use the checkout url that you would normally use for git.

cpanm https://<YOUR_USER_HERE>@<REPO_HOST_HERE>/<PATH_TO_GIT_HERE>.git@<BRANCH_HERE / COMMIT_HASH_HERE>
Using local files

If you've checkout out the repository or unpacked the release tarball, you can run the following from the folder containing this README:

# Install from the directory the README file is in after unpacking the tar.gz
cpanm .
Installing cpanm (App::cpanminus)

https://metacpan.org/pod/App::cpanminus#INSTALLATION

Install using cpan

cpan .

Install using Module::Build

perl Build.PL
./Build clean         # Clean up build files
./Build installdeps   # Install any missing dependencies. May require superuser privs
./Build               # After this step, you should have entry point(s) in .\blib\script
./Build test          # Run tests for cromulency 
./Build install       # Add entry point(s) to your path. May require superuser privs

See https://metacpan.org/pod/Module::Build for more info on Module::Build

Install using Make

# *nix
perl Makefile.PL
make
make test
make install
# Activeperl
perl Makefile.PL
dmake.exe
dmake.exe test
dmake.exe install

Manual Dependency Install

If you don't want to or can't install dependencies via Build installdeps, you can install them manually via your favorite management system.

The dependency list can be reviewed here.

Example Commands To Install Log Log4perl On Various Platforms
  • cpan install Log::Log4perl (cpan)
  • ppm install Log-Log4perl (ActivePerl)
  • sudo apt install liblog-log4perl-perl (Ubuntu/Debian)
  • sudo yum install perl-Log-Log4perl (CentOS/RedHat)

Troubleshooting

Users have reporting issues installing certain modules on Windows platforms. If one or more libraries fail to load due to failing tests on Windows, consider installing with the force flag turned on:

cpan install -f Log::Log4perl

Run Without Installing

You can run the model-citizen app without installing by invoking it in the ./script directory.

Note, you will have to install any missing dependencies manually. If you have locally downloaded libraries, you can add them to @INC via the -I flag when invoking the Perl interpreter. See the official perlrun documentation for more info.

perl -I '.\vendor' .\script\model-citizen --help

Usage

Help

Print usage info

model-citizen --help

Export Model as SQL and or JSON array

Load up data modeler files and generate a DDL SQL output file and a json output file

model-citizen  --outputFileSQL ./scratch/model.sql --outputFileJSON ./scratch/model.json --modelFilepath C:\git\datamodels\MY_AWESOME_DATA_MODEL\

Load JSON output to MongoDB

The json output is an array of documents describing the data model. These can be fed directly into mongoDB using a tool such as mongoimport using the --jsonArray option.

mongoimport.exe --db model-citizen --collection model --file "C:\git\model-citizen\scratch\model.json"
 --host localhost:27017 -v --stopOnError --jsonArray;

Sample Models

Sample data models can be found here.

Note: These models may be an older format (v2.x or v3.x) and will yield better results if upgraded using a more recent version of the Data Modeler utility.

Contributing

If you are interested in contributing to the project, please check out our Contributor's Guide.

About

Export Oracle Data Modeler files as json and or SQL DDL for easier consumption by other processes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published