Skip to content

Commit 859a5d6

Browse files
committed
fix: filter non-included schemas
1 parent a73dd6e commit 859a5d6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/server/templates/python.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ export const apply = ({
2424
return py_class_and_methods
2525
})
2626
const composite_types = types
27-
.filter((type) => type.attributes.length > 0)
27+
.filter((type) => type.attributes.length > 0 && schemas.some((schema) => type.schema == schema.name))
2828
.map((type) => ctx.typeToClass(type))
29-
const py_views = views.map((view) => ctx.viewToClass(view))
30-
const py_matviews = materializedViews.map((matview) => ctx.matViewToClass(matview))
29+
const py_views = views
30+
.filter((view) => schemas.some((schema) => schema.name === view.schema))
31+
.map((view) => ctx.viewToClass(view))
32+
const py_matviews = materializedViews
33+
.filter((matview) => schemas.some((schema) => schema.name === matview.schema))
34+
.map((matview) => ctx.matViewToClass(matview))
3135

3236
let output = `
3337
from __future__ import annotations

0 commit comments

Comments
 (0)