-
-
Save bjoernhaeuser/5b38a72d03a5db2e40ba to your computer and use it in GitHub Desktop.
This file contains 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
""" | |
Filters event based on schema and table | |
""" | |
from ConfigParser import NoOptionError, NoSectionError | |
class EventFilter(object): | |
""" | |
Filters event based on schema and table | |
""" | |
def __init__(self, config): | |
self.config = config | |
def filter(self, obj): | |
""" | |
:param obj: object to filter, should contain values for schema and table | |
:return: True if the object is on whitelist | |
""" | |
if not hasattr(obj, 'schema'): | |
return True | |
try: | |
self.config.get(obj.schema, obj.table) | |
return True | |
except (NoOptionError, NoSectionError): | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment