Skip to content

Commit 1ba2f5b

Browse files
sqlparserJamesclaude
authored
Take the JDBC connectors off the trial path, drop /fromdb, add a schema that fits (#55)
Three findings from the 2026-08-24 first-visit evaluation, all of them the same shape: a trial user meets a licensed-only or non-existent feature and reads the failure as "GSP does not work". connector/ -> licensed-only/ These modules need gudusoft.gsqlparser.sqlenv.T*SQLDataSource, which the public trial artifact does not ship. At the repository root they read as part of the ordinary demo set, and the evaluator started there. Now the directory says what they are, licensed-only/README.md says why, and each POM carries a default-active trial-guard profile that stops at validate with a message naming the boundary and pointing at columninspect, which does the same metadata-aware resolution offline. -Plicensed turns the guard off. The guard could not fire until the drivers were real coordinates: Oracle's was com:ojdbc:1.1.1 and SQL Server's sqljdbc4:4.0, both system scope pointing into lib/ at jars that have never existed here, so Maven died during dependency resolution before any plugin could speak. They are ojdbc8 and mssql-jdbc from Central now, which also removes the last two system-scope dependencies in the repository and makes them visible to Dependabot. /fromdb, /exportonly and /metadataoutput removed They parsed and did nothing. SqlflowIngester.export(...) was commented out and the class deleted, so the tool emitted an empty <dlineage/> and wrote no metadata.json, while the readme taught the feature in two sections with four vendor examples. /fromdb now gets the same answer as passing no input at all. A parsed no-op is worse than a missing feature: the docs grow around it. samples/dlineageBasic/oracle/hr_mini/ All 16 oversize .sql files under samples/ are vendor dumps in dlineageBasic/ -- 10,378 to 99,139 bytes against a 10,000-byte trial cap -- so "lineage on a real schema" returned a licence error dressed as an <error> element inside otherwise-normal output, which reads as "no lineage found". hr_mini is 5,212 bytes and yields 120 relationships (82 fdd, 38 fdr) from staging tables, a view over a LEFT JOIN, a CTE, aggregates, CASE WHEN and a correlated subquery, with all its DDL inline so every column resolves. Both new behaviours are CI-enforced, and both assert on output rather than exit status, because both failure modes exit 0 or fail for a plausible-looking wrong reason: - check-licensed-only-guard.sh asserts each module prints the licence message AND fails; failing with the old "cannot find symbol" also exits non-zero. - smoke-dlineage-jar.sh fails if hr_mini reaches 10,000 bytes, drops below 50 relationships, or starts carrying the trial-limit error. Claude-Session: https://claude.ai/code/session_01UK3dBXFXqiDRYJxz1YxWCr Co-authored-by: James <James@gudusoft.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent e219c11 commit 1ba2f5b

26 files changed

Lines changed: 821 additions & 218 deletions

File tree

.githooks/pre-commit

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#
2222
# It checks the *index*, not the working tree, because the index is what you
2323
# are about to commit. Staging pom.xml while leaving the matching
24-
# connector/*/pom.xml edits unstaged is precisely the drift being guarded
24+
# licensed-only/*/pom.xml edits unstaged is precisely the drift being guarded
2525
# against, and a working-tree check would call that clean.
2626

2727
set -uo pipefail
@@ -77,7 +77,7 @@ pre-commit: the parser version disagrees across the POMs you are committing.
7777
git add -u && git commit then commit again
7878
7979
Never edit a version by hand: it is written in pom.xml and in each of the three
80-
connector/*/pom.xml, which are separate builds with no parent to inherit it.
80+
licensed-only/*/pom.xml, which are separate builds with no parent to inherit it.
8181
In practice you should not be editing one at all -- the nightly tests the newest
8282
release and opens a pre-verified bump PR.
8383
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Prove the licensed-only modules refuse to build with an explanation.
4+
#
5+
# licensed-only/{oracle,snowflake,sqlServer}Connector need a LICENSED parser:
6+
# the public trial artifact this repository resolves does not ship
7+
# gudusoft.gsqlparser.sqlenv.T*SQLDataSource. Before 2026-08-24 they simply
8+
# failed -- javac's "cannot find symbol" for snowflake, and for the other two a
9+
# dependency-resolution error about a JDBC jar nobody had, thrown before any
10+
# plugin could speak. A first-time evaluator read that as "this library does not
11+
# compile" and said so in an evaluation report.
12+
#
13+
# Now each POM stops at validate with a message naming the licensing boundary
14+
# and pointing at the trial-friendly alternative. That message is the whole
15+
# feature, so this asserts on the message, not on the exit status: a build that
16+
# fails for the old confusing reason also exits non-zero.
17+
#
18+
# Usage:
19+
# check-licensed-only-guard.sh
20+
21+
set -euo pipefail
22+
23+
cd "$(dirname "${BASH_SOURCE[0]}")/../.."
24+
25+
MODULES=(oracleConnector snowflakeConnector sqlServerConnector)
26+
NEEDLE="needs a LICENSED General SQL Parser"
27+
28+
failed=0
29+
30+
for m in "${MODULES[@]}"; do
31+
pom="licensed-only/$m/pom.xml"
32+
if [ ! -f "$pom" ]; then
33+
echo " FAIL $pom is missing"
34+
failed=1
35+
continue
36+
fi
37+
38+
out=$(mvn -B -f "$pom" validate 2>&1 || true)
39+
40+
if ! grep -qF "$NEEDLE" <<<"$out"; then
41+
echo " FAIL $m built or failed without explaining the licence boundary"
42+
echo "$out" | tail -20 | sed 's/^/ /'
43+
failed=1
44+
continue
45+
fi
46+
47+
# It must be the guard that stopped it, not something incidental that
48+
# happened to print the same words.
49+
if ! grep -q "BUILD FAILURE" <<<"$out"; then
50+
echo " FAIL $m printed the message but the build succeeded"
51+
failed=1
52+
continue
53+
fi
54+
55+
echo " ok $m stops at validate and says why"
56+
done
57+
58+
echo
59+
60+
if [ "$failed" -ne 0 ]; then
61+
echo "::error::a licensed-only module no longer refuses the trial build with an explanation"
62+
exit 1
63+
fi
64+
65+
echo "ok: all ${#MODULES[@]} licensed-only modules refuse the trial build with an explanation"

.github/scripts/set-parser-version.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
# it down.
55
#
66
# The version lives in four files. The root build declares it as a
7-
# ${gsp.core.version} property, and the three connector/ modules hardcode the
8-
# version in their gsqlparser dependency, because they are separate builds with
9-
# no parent to inherit a property from. Nothing made them agree, so they could
7+
# ${gsp.core.version} property, and the three licensed-only/ connector modules
8+
# hardcode the version in their gsqlparser dependency, because they are separate
9+
# builds with no parent to inherit a property from. (They lived under
10+
# connector/ until 2026-08-24; see licensed-only/README.md for why they moved.) Nothing made them agree, so they could
1011
# drift apart silently -- and a bump meant four hand edits, which is most of why
1112
# bumping felt expensive.
1213
#
@@ -61,8 +62,8 @@ TARGETS = [
6162
]
6263
for mod in ("oracleConnector", "snowflakeConnector", "sqlServerConnector"):
6364
TARGETS.append((
64-
"connector/%s/pom.xml" % mod,
65-
"connector/%s dependency" % mod,
65+
"licensed-only/%s/pom.xml" % mod,
66+
"licensed-only/%s dependency" % mod,
6667
# Anchor on the gsqlparser dependency so we never touch the JDBC
6768
# driver's <version> sitting a few lines below it.
6869
r"(?s)(<artifactId>gsqlparser</artifactId>\s*<version>)([^<]+)(</version>)",

.github/scripts/smoke-dlineage-jar.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,43 @@ if not rel:
9696
print("ok: XML output, %d relationships" % len(rel))
9797
PY
9898

99+
# --- a whole schema, under the trial cap -----------------------------------
100+
# samples/dlineage/demo.sql is 366 bytes. Every real schema dump under
101+
# samples/dlineageBasic/ is over the trial parser's 10,000-byte limit, so a
102+
# visitor who tried "lineage on a real schema" got a licence error and no
103+
# lineage. hr_mini exists to be the one that fits, which makes its size the
104+
# thing worth guarding: grow it past the cap and the demo silently stops
105+
# working for every trial user, while the tool goes on exiting 0.
106+
SCHEMA="samples/dlineageBasic/oracle/hr_mini/hr_mini.sql"
107+
CAP=10000
108+
109+
[ -f "$SCHEMA" ] || fail "$SCHEMA is missing"
110+
111+
bytes=$(wc -c <"$SCHEMA")
112+
if [ "$bytes" -ge "$CAP" ]; then
113+
fail "$SCHEMA is $bytes bytes, at or over the trial parser's $CAP-byte limit; it exists precisely so schema-scale lineage is runnable on the trial jar. Shrink it, or put the addition in one of the licensed-only dumps."
114+
fi
115+
echo "ok: $SCHEMA is $bytes bytes, under the $CAP-byte trial limit"
116+
117+
java -jar "$JAR" /f "$SCHEMA" /t oracle /o "$OUT/schema.json" /json
118+
119+
[ -s "$OUT/schema.json" ] || fail "schema.json is empty or missing"
120+
121+
python3 - "$OUT/schema.json" <<'PY'
122+
import json, sys
123+
d = json.load(open(sys.argv[1]))
124+
rel = d.get("relationships") or []
125+
if not rel:
126+
sys.exit("hr_mini parsed but produced no relationships")
127+
# A licence rejection is not an exception: the tool reports it as an error
128+
# inside an otherwise well-formed document and exits 0, which reads as
129+
# "no lineage found" unless something goes looking for it.
130+
if "trial version can only process" in json.dumps(d):
131+
sys.exit("hr_mini hit the trial size limit; it is no longer trial-evaluable")
132+
if len(rel) < 50:
133+
sys.exit("hr_mini produced only %d relationships; it produced 120 when it "
134+
"was added, so the schema or the analyzer has regressed" % len(rel))
135+
print("ok: schema-scale lineage, %d relationships from hr_mini" % len(rel))
136+
PY
137+
99138
echo "ok: the standalone dlineage jar runs and produces lineage in both formats"

.github/workflows/build.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ jobs:
7373
echo
7474
.github/scripts/check-stale-docs.sh
7575
76+
# The three licensed-only/ modules cannot compile against the public
77+
# trial parser, and used to say so only in javac's words -- "cannot find
78+
# symbol", or worse, a dependency-resolution error about a JDBC jar
79+
# nobody had. An evaluator read that as a broken library. Each POM now
80+
# stops at validate with a message naming the licensing boundary, and the
81+
# message is the feature, so this asserts on the message: failing for the
82+
# old confusing reason also exits non-zero.
83+
- name: Licensed-only modules refuse the trial build, with a reason
84+
if: matrix.java == '21'
85+
run: .github/scripts/check-licensed-only-guard.sh
86+
7687
- name: Build
7788
run: mvn -B package -DskipTests
7889

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ jobs:
240240
--title "Bump the parser from $pinned to $NEW" \
241241
--body "\`$NEW\` is the newest release on sqlparser.com. Tonight's nightly ran it through the same checks the pinned \`$pinned\` gets, and it passed all of them: the full test suite with no failures, every demo starting, and every case in \`.github/scripts/demo-cases.tsv\` producing its expected output.
242242
243-
This touches the four places the version is written -- \`pom.xml\` and the three \`connector/*/pom.xml\` -- via \`.github/scripts/set-parser-version.sh\`, so they cannot drift apart.
243+
This touches the four places the version is written -- \`pom.xml\` and the three \`licensed-only/*/pom.xml\` -- via \`.github/scripts/set-parser-version.sh\`, so they cannot drift apart.
244244
245245
Merge to move the demos to \`$NEW\`. Close to stay on \`$pinned\`; the nightly will go on testing \`$NEW\` and will not reopen this until a newer release appears.
246246

README.md

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,23 @@ any individual demo.
146146

147147
`samples/` holds sample `.sql` files to feed them.
148148

149-
### Demos that connect to a database
149+
### Demos that connect to a database — licensed parser only
150150

151-
`connector/{oracleConnector,snowflakeConnector,sqlServerConnector}/` are
151+
`licensed-only/{oracleConnector,snowflakeConnector,sqlServerConnector}/` are
152152
separate, independently built Maven modules showing JDBC-connected metadata
153-
extraction. They are **not** part of `mvn package` or `mvn test` at the root;
154-
build each on its own. Each module's `lib/` holds only a readme — you download
155-
the JDBC driver yourself, and the version in that module's `pom.xml` tells you
156-
which.
153+
extraction. **They cannot be built with the trial parser**, which does not ship
154+
`gudusoft.gsqlparser.sqlenv.T*SQLDataSource`; each stops at `validate` with a
155+
message saying so, and `-Plicensed` turns that guard off once you have a
156+
licensed parser. They are not part of `mvn package` or `mvn test` at the root.
157+
See [`licensed-only/README.md`](licensed-only/README.md).
158+
159+
They sat in `connector/` until 2026-08-24, where they read as part of the
160+
ordinary demo set: a first-time evaluation started there, met `cannot find
161+
symbol`, and concluded the library did not compile.
162+
163+
**On the trial parser, `columninspect` is the thing to run instead.** It does
164+
the same metadata-aware column resolution from a JSON catalog export rather
165+
than a live connection, and `samples/columninspect/` has a runnable pair.
157166

158167
## Rewriting SQL through the parse tree
159168

@@ -217,9 +226,19 @@ version (e.g. `4.1.9`) does not necessarily match the one in the release notes.
217226

218227
> **The trial build refuses input larger than 10,000 bytes**, reporting
219228
> `trial version can only process query with size of at most 10000 bytes`.
229+
> The limit is on a single parse, not on total throughput.
230+
>
220231
> Every demo here works within that except `scriptwriter`, whose built-in query
221232
> is ~49 KB on purpose — give it your own smaller file, or use a licensed
222-
> parser. The limit is on a single parse, not on total throughput.
233+
> parser. **16 of the 89 `.sql` files under `samples/` are also over the
234+
> limit**, all of them vendor schema dumps under `samples/dlineageBasic/`
235+
> (10,378 to 99,139 bytes). Those are for licensed evaluation; the rejection
236+
> arrives as an `<error>` inside otherwise-normal output, which reads as "no
237+
> lineage found" rather than as a licence limit. For schema-scale lineage on
238+
> the trial jar use
239+
> [`samples/dlineageBasic/oracle/hr_mini/`](samples/dlineageBasic/oracle/hr_mini/readme.md)
240+
> — 5,212 bytes, 120 relationships, added for that purpose and size-checked in
241+
> CI.
223242
224243
### Published versions are kept; one batch was recalled in July 2026
225244

@@ -265,7 +284,7 @@ One command, never by hand:
265284

266285
The version lives in **four** files — the `${gsp.core.version}` property in
267286
`pom.xml`, plus a hardcoded `<version>` in each of the three
268-
`connector/*/pom.xml`, which are separate builds with no parent to inherit a
287+
`licensed-only/*/pom.xml`, which are separate builds with no parent to inherit a
269288
property from. Both workflows run `--check`, so a missed file is a red build
270289
rather than a connector quietly compiling against an older parser.
271290

@@ -314,7 +333,7 @@ src/main/java/gudusoft/gsqlparser/demos/<demo>/ the demos, one dir per topic
314333
src/main/resources/ classpath resources (one file)
315334
src/test/java/gudusoft/gsqlparser/ tests, all exercising demos
316335
samples/ sample .sql for the demos
317-
connector/<vendor>Connector/ separate JDBC-connected modules
336+
licensed-only/<vendor>Connector/ JDBC modules, licensed parser only
318337
lib-repo/ in-project Maven repository
319338
setenv/ + per-demo *.bat the Windows route
320339
.github/scripts/ CI checks, all runnable locally
@@ -408,9 +427,10 @@ than only building them.
408427
| Parser version consistency | `set-parser-version.sh --check` across all four POMs |
409428
| The pre-commit hook | `test-pre-commit-hook.sh`: a drifting bump is refused in a throwaway clone |
410429
| Documentation | `check-stale-docs.sh`: no readme names `pom_dlineage.xml`, `gudusoft.dlineage.jar` or the old `demos` package root; `--self-test` first, so a check that matches nothing cannot pass as a clean repo |
430+
| Licensed-only guard | `check-licensed-only-guard.sh`: each `licensed-only/*` module stops at `validate` **with the licence message**, not with `cannot find symbol` |
411431
| Build and test | JDK 8 and 21; 156 tests, and a run that skipped everything fails |
412432
| Demo smoke test | `checksyntax` against known SQL |
413-
| Standalone lineage jar | `smoke-dlineage-jar.sh` on JDK 8 and 21 — asserts on **output**, in JSON *and* XML |
433+
| Standalone lineage jar | `smoke-dlineage-jar.sh` on JDK 8 and 21 — asserts on **output**, in JSON *and* XML, and that `hr_mini.sql` stays under the trial parser's 10,000-byte cap |
414434
| Windows `.bat` | `windows-latest`: bootstrap, 39 compile scripts, 50 run scripts, 4 driven with real arguments |
415435

416436
`.github/workflows/nightly.yml` — at 03:17 UTC, because the parser is the moving
@@ -476,7 +496,7 @@ drive with arguments.
476496
- **Don't commit jars**; add dependencies by coordinate.
477497
- **Don't add a live-JDBC path to a demo** under `src/main/java`. It can't run
478498
in CI, and it is what got two demos excluded from the build for years. The
479-
`connector/*` modules are where database connections belong.
499+
`licensed-only/*` modules are where database connections belong.
480500
- **Don't add parser tests here**; they belong in `gsp_java_core`.
481501

482502
`master` tracks released GSP versions from

connector/oracleConnector/lib/readme.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

connector/oracleConnector/pom.xml

Lines changed: 0 additions & 74 deletions
This file was deleted.

connector/snowflakeConnector/lib/readme.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)