Skip to content

Commit f2b260b

Browse files
Merge pull request #1985 from schemacrawler/operations
Create submodule for operations, and add a tablesample command
2 parents 1e64fc2 + a9fe84b commit f2b260b

File tree

148 files changed

+2122
-8088
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+2122
-8088
lines changed

.github/workflows/early-release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,15 @@ jobs:
8181
name: Setup Docker Buildx
8282
uses: docker/setup-buildx-action@v3
8383

84-
- name: Log into Docker Hub
84+
- id: docker-login
85+
name: Log into Docker Hub
8586
uses: docker/login-action@v3
8687
with:
8788
username: ${{ secrets.DOCKER_USERNAME }}
8889
password: ${{ secrets.DOCKER_PASSWORD }}
8990

90-
- name: Build and Push Docker Image
91+
- id: build-docker-image
92+
name: Build and Push Docker Image
9193
uses: docker/build-push-action@v6
9294
with:
9395
file: ./schemacrawler-docker/Dockerfile

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@ jobs:
6262
name: Setup Docker Buildx
6363
uses: docker/setup-buildx-action@v3
6464

65-
- name: Log into Docker Hub
65+
- id: docker-login
66+
name: Log into Docker Hub
6667
uses: docker/login-action@v3
6768
with:
6869
username: ${{ secrets.DOCKER_USERNAME }}
6970
password: ${{ secrets.DOCKER_PASSWORD }}
7071

71-
- name: Build and Push Docker Image
72+
- id: build-docker-image
73+
name: Build and Push Docker Image
7274
uses: docker/build-push-action@v6
7375
with:
7476
file: ./schemacrawler-docker/Dockerfile

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<module>schemacrawler-loader</module>
2424
<module>schemacrawler-text</module>
2525
<module>schemacrawler-diagram</module>
26+
<module>schemacrawler-operations</module>
2627
<module>schemacrawler</module>
2728
<!-- Additional functionality -->
2829
<module>schemacrawler-commandline</module>

schemacrawler-api/src/main/java/schemacrawler/schemacrawler/InformationSchemaKey.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import static schemacrawler.schemacrawler.InformationSchemaKeyType.DATABASE_METADATA;
1313
import static schemacrawler.schemacrawler.InformationSchemaKeyType.INFORMATION_SCHEMA;
1414
import static schemacrawler.schemacrawler.InformationSchemaKeyType.METADATA_EXTENSION;
15+
import static schemacrawler.schemacrawler.InformationSchemaKeyType.OPERATION;
1516

1617
public enum InformationSchemaKey {
1718
ADDITIONAL_COLUMN_ATTRIBUTES(ADDITIONAL_INFO),
@@ -21,14 +22,13 @@ public enum InformationSchemaKey {
2122
DATABASE_USERS(ADDITIONAL_INFO),
2223
EXT_HIDDEN_TABLE_COLUMNS(METADATA_EXTENSION),
2324
EXT_INDEXES(METADATA_EXTENSION),
24-
EXT_TABLE_CONSTRAINTS(METADATA_EXTENSION),
2525
EXT_SYNONYMS(METADATA_EXTENSION),
2626
EXT_TABLES(METADATA_EXTENSION),
27+
EXT_TABLE_CONSTRAINTS(METADATA_EXTENSION),
2728
FOREIGN_KEYS(DATABASE_METADATA),
2829
FUNCTIONS(DATABASE_METADATA),
2930
FUNCTION_COLUMNS(DATABASE_METADATA),
3031
INDEXES(DATABASE_METADATA),
31-
TYPE_INFO(DATABASE_METADATA),
3232
PRIMARY_KEYS(DATABASE_METADATA),
3333
PROCEDURES(DATABASE_METADATA),
3434
PROCEDURE_COLUMNS(DATABASE_METADATA),
@@ -38,10 +38,12 @@ public enum InformationSchemaKey {
3838
SERVER_INFORMATION(ADDITIONAL_INFO),
3939
TABLES(DATABASE_METADATA),
4040
TABLE_COLUMNS(DATABASE_METADATA),
41-
TABLE_PRIVILEGES(DATABASE_METADATA),
4241
TABLE_COLUMN_PRIVILEGES(DATABASE_METADATA),
4342
TABLE_CONSTRAINTS(INFORMATION_SCHEMA),
43+
TABLE_PRIVILEGES(DATABASE_METADATA),
44+
TABLESAMPLE(OPERATION), // TABLESAMPLE (no underscore) is an operation
4445
TRIGGERS(INFORMATION_SCHEMA),
46+
TYPE_INFO(DATABASE_METADATA),
4547
VIEWS(INFORMATION_SCHEMA),
4648
VIEW_TABLE_USAGE(INFORMATION_SCHEMA),
4749
;

schemacrawler-api/src/main/java/schemacrawler/schemacrawler/InformationSchemaKeyType.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ public enum InformationSchemaKeyType {
1212
ADDITIONAL_INFO,
1313
INFORMATION_SCHEMA,
1414
DATABASE_METADATA,
15-
METADATA_EXTENSION
15+
METADATA_EXTENSION,
16+
OPERATION
1617
}

schemacrawler-api/src/main/java/schemacrawler/schemacrawler/QueryUtility.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private static Map<String, String> makeVariablesMap(
183183
tableProperties.put("tablename", table.getName());
184184
tableProperties.put("columns", MetaDataUtility.joinColumns(columns, false, identifiers));
185185
tableProperties.put(
186-
"orderbycolumns", MetaDataUtility.joinColumns(columns, true, identifiers));
186+
"basiccolumns", MetaDataUtility.joinColumns(columns, true, identifiers));
187187
tableProperties.put("tabletype", table.getTableType().toString());
188188
}
189189

schemacrawler-commandline/pom.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@
5454
<type>test-jar</type>
5555
<scope>test</scope>
5656
</dependency>
57+
<dependency>
58+
<groupId>us.fatehi</groupId>
59+
<artifactId>schemacrawler-operations</artifactId>
60+
<version>${project.version}</version>
61+
<type>test-jar</type>
62+
<scope>test</scope>
63+
</dependency>
5764

5865
<dependency>
5966
<groupId>com.typesafe</groupId>

schemacrawler-commandline/src/test/java/schemacrawler/test/AvailablePluginsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void availableCommands() {
4545
assertThat(
4646
new AvailableCommands(),
4747
contains(
48-
"brief", "count", "details", "dump", "list", "quickdump", "schema", "test-command"));
48+
"brief", "count", "details", "dump", "list", "schema", "tablesample", "test-command"));
4949
}
5050

5151
@Test

schemacrawler-commandline/src/test/java/schemacrawler/test/SpinThroughOperationsCommandLineTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static void clean() throws Exception {
4646
}
4747

4848
protected static Stream<Arguments> spinThroughArguments() {
49-
return EnumSet.allOf(OperationType.class).stream()
49+
return EnumSet.complementOf(EnumSet.of(OperationType.tablesample)).stream()
5050
.flatMap(
5151
operation ->
5252
EnumSet.complementOf(EnumSet.of(InfoLevel.unknown)).stream()

schemacrawler-commandline/src/test/resources/shell_commands_output/availableCommands.stdout.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ Available SchemaCrawler Commands:
88
constraints
99
dump Show data from all rows in the tables
1010
list Show a list of schema objects
11-
quickdump Show data from all rows in the tables, but row order is not
12-
guaranteed - this can be used with a minimum info-level for
13-
speed
1411
schema Show the commonly needed detail of the schema, including
1512
details of tables, views and routines, columns, primary keys,
1613
indexes, foreign keys, and triggers
14+
tablesample Show sample data from tables, but the samples are not the same
15+
from run to run
1716
test-command Test command which is not deployed with the release
1817
<query_name> Show results of query <query_name>, as specified in the
1918
configuration properties file

0 commit comments

Comments
 (0)