# Path: sesql/config.py
# CONFIG_PATH_FALLBACK = 'sesql_config'
#     CONFIG_PATH = getattr(settings, 'SESQL_CONFIG_PATH', CONFIG_PATH_FALLBACK)
#     CONFIG_PATH = CONFIG_PATH_FALLBACK
# 
# Path: sesql/typemap.py
# class TypeMap(object):
#     def __init__(self):
#     def all_subclasses(klass, done = None):
#     def all_tables(self):
#     def all_classes(self):
#     def all_class_names(self):
#     def get_class_names_for(self, table):
#     def get_classes_for(self, table):
#     def get_table_for(self, klass):
#     def get_class_by_name(self, klass):


from sesql import config
from sesql.typemap import typemap
        STOPWORDS = %s
)""" % (config.TS_CONFIG_NAME, config.STOPWORDS_FILE),
        """ALTER TEXT SEARCH CONFIGURATION %s
        ALTER MAPPING FOR asciiword, asciihword, hword_asciipart WITH %s_dict""" % (config.TS_CONFIG_NAME, config.TS_CONFIG_NAME)
        ] + getattr(config, "ADDITIONAL_TS_CONFIG", [])

@sql_function
def create_master_table():
    """
    Create the master table, that is, the one from which the others
    will inherit
    """
    schema = "\n  ".join([ field.schema() for field in config.FIELDS ])

    return [
        "DROP TABLE IF EXISTS %s CASCADE" % config.MASTER_TABLE_NAME,
        """CREATE TABLE %s (
%s
  PRIMARY KEY (classname, id)
)""" % (config.MASTER_TABLE_NAME, schema)
        ]

@sql_function
def create_table(table = None):
    """
    Create given table
    """
    if table is None:
        return []


# Path: sesql/config.py
# CONFIG_PATH_FALLBACK = 'sesql_config'
#     CONFIG_PATH = getattr(settings, 'SESQL_CONFIG_PATH', CONFIG_PATH_FALLBACK)
#     CONFIG_PATH = CONFIG_PATH_FALLBACK
# 
# Path: sesql/typemap.py
# class TypeMap(object):
#     def __init__(self):
#     def all_subclasses(klass, done = None):
#     def all_tables(self):
#     def all_classes(self):
#     def all_class_names(self):
#     def get_class_names_for(self, table):
#     def get_classes_for(self, table):
#     def get_table_for(self, klass):
#     def get_class_by_name(self, klass):


# Path: sesql/datamodel.py
from sesql import config
from sesql.typemap import typemap

        STOPWORDS = %s
)""" % (config.TS_CONFIG_NAME, config.STOPWORDS_FILE),
        """ALTER TEXT SEARCH CONFIGURATION %s
        ALTER MAPPING FOR asciiword, asciihword, hword_asciipart WITH %s_dict""" % (config.TS_CONFIG_NAME, config.TS_CONFIG_NAME)
        ] + getattr(config, "ADDITIONAL_TS_CONFIG", [])

@sql_function
def create_master_table():
    """
    Create the master table, that is, the one from which the others
    will inherit
    """
    schema = "\n  ".join([ field.schema() for field in config.FIELDS ])

    return [
        "DROP TABLE IF EXISTS %s CASCADE" % config.MASTER_TABLE_NAME,
        """CREATE TABLE %s (
%s
  PRIMARY KEY (classname, id)
)""" % (config.MASTER_TABLE_NAME, schema)
        ]

@sql_function
def create_table(table = None):
    """
    Create given table
    """
    if table is None:
        return []


    condition = typemap.get_class_names_for(table)