示例#1
0
        def env_for_plugin(plugin):
            env_struct = {
                "meltano": {
                    plugin.type.singular: {  # MELTANO_EXTRACTOR_...
                        "name": plugin.name,
                        "namespace": plugin.namespace,
                    },
                    plugin.type.singular[0:-2]: plugin.config,  # MELTANO_EXTRACT_...
                },
                **plugin.config_env,  # TAP_...
            }
            env_vars = flatten(env_struct, "env_var").items()

            return {k: str(v) for k, v in env_vars if v is not None}
示例#2
0
def get_plugin_configuration(plugin_ref) -> Response:
    """
    endpoint for getting a plugin's configuration
    """
    project = Project.find()
    settings = PluginSettingsService(project)
    config = flatten(settings.as_config(db.session, plugin_ref, redacted=True),
                     reducer="dot")

    return jsonify({
        # freeze the keys because they are used for lookups
        "config": freeze_keys(config),
        "settings": settings.get_definition(plugin_ref).settings,
    })
示例#3
0
def config_metadata_rules(config):
    flat_config = flatten(config, "dot")

    rules = []
    for key, value in flat_config.items():
        # <tap_stream_id>.<key>
        # <tap_stream_id>.<prop>.<key>
        # <tap_stream_id>.<prop>.<subprop>.<key>
        # <tap_stream_id>.properties.<prop>.<key>
        # <tap_stream_id>.properties.<prop>.properties.<subprop>.<key>
        tap_stream_id, *props, key = key.split(".")

        rules.append(
            MetadataRule(
                tap_stream_id=tap_stream_id,
                breadcrumb=property_breadcrumb(props),
                key=key,
                value=value,
            ))

    return rules
 def flat_meltano_yml_config(self):
     return flatten(self.meltano_yml_config, "dot")
示例#5
0
 def info_env(self):
     # MELTANO_EXTRACTOR_...
     return flatten({"meltano": {self.type.singular: self.info}}, "env_var")
示例#6
0
 def flat_current_config(self):
     return flatten(self._current_config, "dot")