Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes made for table iteration #25

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions paracelsus/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import os
import sys
from pathlib import Path
import re
from typing import List, Set

from sqlalchemy import MetaData

from sqlalchemy.schema import MetaData
from .transformers.dot import Dot
from .transformers.mermaid import Mermaid

Expand Down Expand Up @@ -83,9 +83,12 @@ def resolve_included_tables(
case 0, 0:
return all_tables
case 0, int():
return all_tables - exclude_tables
excluded = {table for table in all_tables if any(re.match(pattern, table) for pattern in exclude_tables)}
return all_tables - excluded
case int(), 0:
if not include_tables.issubset(all_tables):
included = {table for table in all_tables if any(re.match(pattern, table) for pattern in include_tables)}

if not included:
non_existent_tables = include_tables - all_tables
raise ValueError(
f"Some tables to include ({non_existent_tables}) don't exist"
Expand Down