feat: add Oracle PL/SQL support (.pkb/.pks/.pls/.plb)#1994
Open
ezadEzanee wants to merge 1 commit into
Open
Conversation
Add support for Oracle PL/SQL (.pkb, .pks, .pls, .plb) files across
detection, extraction, and file routing:
- detect.py: add .pkb, .pks, .pls, .plb to CODE_EXTENSIONS so PL/SQL
files are classified as code
- extract.py: route .pkb/.pks/.pls/.plb extensions to extract_sql and
declare them as requiring the optional [sql] dependency
- extractors/sql.py: support tree-sitter-plsql grammar with automatic
fallback to tree-sitter-sql:
* PL/SQL-specific node types: create_package, create_package_body,
function_declaration/definition, procedure_declaration/definition,
cursor_definition, type_definition_*, exception_declaration
* SQL statement extraction: table references from sql_statement_select,
sql_statement_insert/update/delete/merge
* CREATE TABLE support for PL/SQL grammar (identifier-based names,
table_element > table_column_definition / table_constraint)
* Regex fallback for SQL*Plus extracts without CREATE OR REPLACE headers
* FROM/JOIN/INTO table reference extraction within PL/SQL blocks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Oracle PL/SQL language support to graphify's detection, registration, and extraction pipeline, enabling graphify to parse and extract knowledge from PL/SQL source files (
.pkb,.pks,.pls,.plb).Changes
1.
graphify/detect.py— File classificationAdded
.pkb,.pks,.pls,.plbtoCODE_EXTENSIONSso PL/SQL files are classified as code and processed by the extractor pipeline.2.
graphify/extract.py— Extension routingextract_sqlin the_DISPATCHtable_EXTRA_FOR_EXTENSIONas requiring the[sql]optional dependency3.
graphify/extractors/sql.py— PL/SQL-aware SQL extractorThe SQL extractor now supports both
tree-sitter-sql(standard SQL) andtree-sitter-plsql(Oracle PL/SQL), with graceful fallback:tree_sitter_plsqlfirst, falls back totree_sitter_sqlsql_statement_select,sql_statement_insert,sql_statement_update,sql_statement_delete, andsql_statement_mergetable_element>table_column_definition/table_constraintstructure, including FOREIGN KEY REFERENCESCREATE OR REPLACEheadersExample
With
tree-sitter-plsqlinstalled, graphify will now extract packages, procedures, functions, table operations, and cross-references from files like:Dependencies
The
[sql]optional dependency inpyproject.tomlwill needtree-sitter-plsqladded once published to PyPI.