MCPcopy Create free account
hub / github.com/Houseofmvps/codesight / extractSQLAlchemyAST

Function extractSQLAlchemyAST

src/ast/extract-python.ts:620–638  ·  view source on GitHub ↗
(
  filePath: string,
  content: string
)

Source from the content-addressed store, hash-verified

618 typeof r.lineno === "number" && typeof r.end_lineno === "number"
619 ? detectTagsForLineSpan(lines, r.lineno, r.end_lineno)
620 : tags,
621 framework,
622 params: extractPathParams(r.path),
623 confidence: "ast" as const,
624 }));
625}
626
627/**
628 * Extract SQLAlchemy models from a Python file using AST.
629 * Returns models with confidence: "ast", or null if Python is unavailable.
630 */
631export async function extractSQLAlchemyAST(
632 filePath: string,
633 content: string
634): Promise<SchemaModel[] | null> {
635 const result = await runPythonWithStdin(PYTHON_SCHEMA_SCRIPT, content, filePath);
636 if (!result || !Array.isArray(result) || result.length === 0) return null;
637
638 return result.map((m: any) => ({
639 name: m.name,
640 fields: (m.fields || []).map((f: any) => ({
641 name: f.name,

Callers 1

detectSQLAlchemySchemasFunction · 0.85

Calls 1

runPythonWithStdinFunction · 0.85

Tested by

no test coverage detected