def create_table(table_name, load_postgis, json_table_schema, if_not_exists, indexes_fields, connection_string):
if load_postgis:
load_postgis_support()
creds = re.match(carto_connection_string_regex, connection_string).groups()
statement = CreateTable(get_table(table_name, json_table_schema))
str_statement = statement.compile(dialect=postgresql.dialect())
if if_not_exists:
str_statement = str(str_statement).replace('CREATE TABLE', 'CREATE TABLE IF NOT EXISTS')
carto_sql_call(creds, str_statement)
if indexes_fields:
create_indexes(creds, table_name, indexes_fields)
评论列表
文章目录