Hi There,
I am trying to put together a barebones adapter for MemSQL. I have a very simple adapter plugin set up and installed. When I run dbt compile
I get the following error:
AttributeError: 'MemsqlCredentials' object has no attribute 'schema'
This is true; like MySQL, MemSQL does not support schemas, only databases and tables.
Looking closer, I can see the error stems from File "/usr/local/lib/python3.7/site-packages/dbt_core-0.14.0-py3.7.egg/dbt/context/common.py", line 410, in generate_base "schema": config.credentials.schema
which has the following method:
def generate_base(model, model_dict, config, manifest, source_config,
provider, adapter=None):
"""Generate the common aspects of the config dict."""
if provider is None:
raise dbt.exceptions.InternalException(
"Invalid provider given to context: {}".format(provider))
target_name = config.target_name
target = config.to_profile_info()
del target['credentials']
target.update(config.credentials.serialize(with_aliases=True))
target['type'] = config.credentials.type
target.pop('pass', None)
target['name'] = target_name
adapter = get_adapter(config)
context = {'env': target}
pre_hooks = None
post_hooks = None
db_wrapper = provider.DatabaseWrapper(adapter)
context = dbt.utils.merge(context, {
"adapter": db_wrapper,
"api": {
"Relation": db_wrapper.Relation,
"Column": adapter.Column,
},
"column": adapter.Column,
"config": provider.Config(model_dict, source_config),
"database": config.credentials.database,
"env_var": env_var,
"exceptions": dbt.exceptions.wrapped_exports(model),
"execute": provider.execute,
"flags": dbt.flags,
# TODO: Do we have to leave this in?
"graph": manifest.to_flat_graph(),
"log": log,
"model": model_dict,
"modules": get_context_modules(),
"post_hooks": post_hooks,
"pre_hooks": pre_hooks,
"ref": provider.ref(db_wrapper, model, config, manifest),
"return": _return,
"schema": config.credentials.schema,
"sql": None,
"sql_now": adapter.date_function(),
"source": provider.source(db_wrapper, model, config, manifest),
"fromjson": fromjson,
"tojson": tojson,
"target": target,
"try_or_compiler_error": try_or_compiler_error(model)
})
return context
This function makes an assumption about the presence of schema
in credentials. Is there any way to work around this?