Repository: schemaspy/schemaspy

Issue #222: -all on mysql adds tables from one schema to another in the output
Created: 2018-01-17T21:32:13Z
Expected Behavior
Tables from schema/database CME should not end up in information_schema.
Current Behavior
Table cmeApiQuerySetting is added as a table in schema 'information_schema'.
Possible Solution
The org.schemaspy.service.DatabaseService#getBasicTableMeta first tries with custom query.
Since information_schema doesn't have tables according to custom query.
DatabaseMetaData.getTables() is called. Since Mysql has done their own take on schema/database/catalog.
(yes, they call it schema/database in documentation for mysql and in jdbc it seems to be catalog/database)
So it seems that information_schema might include all datatabases/schemas since it searches catalog = null and mysql jdbc totally ignores schema.
So either only go with DatabaseMetaData.getTables if missing SQLquery or the query fails(SQLException)
Or implement some kind of strategy(remapping) that can adapt Catalog/Schema using information in databaseType. So they both end up with 0 tables.
Steps to Reproduce (for bugs)
SQL Script
CREATE DATABASE CME;

CREATE TABLE CME.cmeApiQuerySetting (
  cmeApiQSid INTEGER AUTO_INCREMENT,
  name varchar(40) NOT NULL,
  value varchar(40) NOT NULL,
  PRIMARY KEY (cmeApiQSid),
  UNIQUE key_unique (name)
) engine=InnoDB;

GRANT SELECT on `CME`.* to test@`%`;
FLUSH PRIVILEGES;

Commandline args
docker run -v "$PWD:/output" schemaspy/schemaspy:snapshot -t mysql -u root -p test -db CME -all -host [host] -port [port]

Context

Database type (e.g. MySQL): mysql:5.6 docker image from docker hub.
Database driver version (is you use a special one): mysql-connector-java-6.0.6.jar
Your DDL (sample how to reproduce the issue):

CREATE DATABASE CME;

CREATE TABLE CME.cmeApiQuerySetting (
  cmeApiQSid INTEGER AUTO_INCREMENT,
  name varchar(40) NOT NULL,
  value varchar(40) NOT NULL,
  PRIMARY KEY (cmeApiQSid),
  UNIQUE key_unique (name)
) engine=InnoDB;

GRANT SELECT on `CME`.* to test@`%`;
FLUSH PRIVILEGES;


Full command including arguments how you run SchemaSpy:

docker run -v "$PWD:/output" schemaspy/schemaspy:snapshot -t mysql -u root -p test -db CME -all -host [host] -port [port]

Your Environment


Version used: docker schemaspy/schemaspy:snapshot (2018-01-16)
Environment name and version (e.g. Chrome 39): N/A
Operating System and version (e.g. Windows 10): Docker
Java version: Docker

Duplicate issue #298: tables with same name in different schemas cannot coexist
Created: 2018-04-09T21:51:14Z
When attempting to use schemaspy with a user who has access to two schemas, one containing a table & the other containing a view with the same name as that table, both will be shown in index.html but both links will point to  tables/${TABLENAME}.html, which describes only one (or a mixture of both).
Expected Behavior

only the specified schema should be shown (see #299)
if both schemas are specified, identically-named table-like entities across multiple schemas should not conflict

Current Behavior
Both entities are shown in index.html but their file in the tables subdirectory conflicts.

with the given DDL & command line, test2.a is described
if test1 and test2 are swapped in the DDL, but the commandline is left alone, and additional table named test_table_1 is included with columns id & name.  test_table_1 is NOT generated for my existing view-only schema, so I don't think this is a general problem for schemas without true tables.
if test1 & test2 are swapped in both the DDL & commandline, a table with the column id2 (as in the view) will be listed for a, but no create view statement shown.

Possible Solution
per-schema folder structure (output/$SCHEMA/$TABLE) or namespaced filename (output/$SCHEMA.$TABLE)
Context

Database type (e.g. MySQL): MySQL installed via homebrew.  mysql --version returns mysql  Ver 14.14 Distrib 5.7.21, for osx10.13 (x86_64) using  EditLine wrapper
Database driver version (is you use a special one): see Docker image
Your DDL (sample how to reproduce the issue):

create database test1;
create database test2;
create table test1.a(id1 int);
create view test2.a as select id1 as id2 from test1.a;
create user 'testUser'@'localhost' identified by 'password';
grant select, show view on test1.* to 'testUser'@'localhost';
grant select, show view on test2.* to 'testUser'@'localhost';
flush privileges


Full command including arguments how you run SchemaSpy: docker run -v /Users/matt.beary/Desktop/example:/output schemaspy/schemaspy:snapshot -db test1 -s test1 -u testUser -p password -t mysql -host docker.for.mac.localhost -port 3306

Your Environment

Version used: see Docker image, seems to be last updated March 26
Environment name and version (e.g. Chrome 39): snapshot docker image
Operating System and version (e.g. Windows 10): OSX 10.13.4, Docker 18.03.0-ce-mac60 (23751)
Java version: see Docker image

Closing comment (2018-04-12T19:42:43Z): Duplicate of #222