원클릭으로
implement-connector
Implement all template methods in a connector's connector.py — the main agent workflow
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Implement all template methods in a connector's connector.py — the main agent workflow
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | implement-connector |
| description | Implement all template methods in a connector's connector.py — the main agent workflow |
| argument-hint | <connector-name> [hybrid] |
| disable-model-invocation | true |
Implement all template methods and remaining BaseConnector methods in connectors/<name>/connector.py. The connection is already working — create_connection and create_cursor are implemented and passing -m connection.
$ARGUMENTS contains:
connector_name (required): e.g., snowflake, bigqueryhybrid (optional): if present, run hybrid mode (skip metadata and query logs)These rules are non-negotiable — follow them throughout the entire workflow:
connectors/<name>/connector.py. Do not modify any files in tests/, conftest.py, or the plugin. The tests are the spec.{x}. Example: return "AVG({x})". The backend substitutes {x} later via .format(). Single braces pass through Jinja untouched.{{ variable }} syntax for values the backend passes at render time. Example: return "CAST({{ expression }} AS NUMERIC)".manifest.json in output/. It is auto-generated by --export.KeyError from .format() means a placeholder name (like {x}) doesn't match what the caller passes.Read all of these before writing any code:
connectors/<name>/connector.py — the file you'll be editingconnectors/_base/connector.py — the base template with all docstrings (this is your API reference)Understand the database dialect you're implementing for. Use web search if you need to look up SQL syntax for this database.
BaseConnector methodsImplement these three methods — they must work before any template test can run:
execute_query(self, query: str) -> NoneExecute the query using the cursor. Handle database-specific error cases if needed (e.g., Teradata wraps "object doesn't exist" errors on DROP to allow idempotent drops).
fetch_all_results(self) -> List[Any]Return all rows from the last executed query. Usually self.cursor.fetchall().
close_connection(self)Clean up cursor and connection. Usually self.cursor.close(); self.connection.close().
After editing connector.py, rebuild so the container picks up your changes:
docker compose build
Work through each section below in order. After implementing each section, run its test marker. Fix failures before moving on.
Implement: get_databases_query_template, get_schemas_query_template, get_tables_query_template, get_columns_query_template
Access check: Metadata queries often rely on system catalog views (information_schema, pg_catalog, sys.*, etc.). Some databases restrict these to admin roles or require paid features. Before implementing, research what permissions the system views require and confirm with the user that MC's database user will have access. If not, look for alternative views that work with standard read-only permissions, or skip the capability.
Key requirements from the docstrings:
get_tables_query_template must return columns: database_name, schema_name, table_name, table_type, and optionally row_count, byte_count, last_update_time, view_queryget_tables_query_template receives offset and limit for pagination, plus optional table_names filterget_columns_query_template must return: full_table_id, column_name, column_typeRun tests:
CONNECTOR=<name> docker compose run --rm test -m metadata
Implement: get_query_logs_query_template
Access check: Query log/history views frequently require elevated privileges (e.g., ACCOUNTADMIN in Snowflake, pg_read_all_stats in PostgreSQL, ACTIVITY_ADMIN in Teradata). Confirm with the user what access the MC database user will have before choosing which system view to query.
Key requirements from the docstring:
start_time, end_time (Python datetime objects), offset, limit.strftime() in Jinja to format timestamps for your databaseRun tests:
CONNECTOR=<name> docker compose run --rm test -m query_logs
Implement: transform_into_count_query_template, add_row_limit_template, get_count_all_expression_template
These are usually straightforward. Check if your database uses TOP N vs LIMIT N vs FETCH FIRST N ROWS ONLY.
Run tests:
CONNECTOR=<name> docker compose run --rm test -m custom_monitors
These are the core building blocks that must pass before metric-specific templates are tested.
Implement all methods in these subsections of QueryLanguageTemplates:
build_cte_template, add_select_clause_template, add_from_clause_template, union_queries_template, alias_field_template, all_fields_expression_template, escape_field_name_template, get_table_identifier_template, get_arbitrary_where_clause_template, ascending_order_template, descending_order_template, get_case_when_func_template, negate_expression_templateescape_string_template, string_literal_template, literal_value_template, literal_datetime_template, literal_time_of_day_template, literal_regex_template, literal_table_from_value_list_template, date_literal_template, utc_literal_templatecast_* and get_casting_* methodscurrent_date_func_template, add_days_func_template, time_truncate_func_template, truncate_to_*_template, etc.)supports_literal_select_template, supports_literal_group_by_template, supports_group_by_on_subquery_template, parses_timestamp_with_trailing_text_template, supports_as_keyword_for_table_alias_template, supports_limit_0_template, requires_subquery_alias_templateis_null_template, is_not_null_template, nan_expr_template, get_isnan_expression_templateget_is_*_expression_template methodsget_avg_function_template, get_stddev_function_template, etc.)get_length_template, substring_func_template, get_is_empty_string_expression_template, get_regexp_expression_template, get_regexp_count_expression_templatearray_expr_template, get_array_length_func_template, get_is_timestamp_expression_template, get_not_is_timestamp_expression_template, get_epoch_seconds_expression_template, get_epoch_seconds_parameter_templateget_absolute_value_function_template, rand_func_templatemax_time_func_template, unpivot_templateget_field_or_alias_templateImportant: Methods that return pass (None) are treated as "not supported" — the test will skip. Only implement methods your database actually supports. For example, most databases don't have native NaN, so nan_expr_template returns pass.
Run tests:
CONNECTOR=<name> docker compose run --rm test -m ql_prerequisites
These tests verify that the prerequisite templates work together correctly to produce metric queries. No new methods to implement — if prerequisites all pass, metrics should too.
Run tests:
CONNECTOR=<name> docker compose run --rm test -m ql_metrics
If metric tests fail but prerequisites pass, the issue is usually in a prerequisite template producing subtly wrong SQL in combination with others. Read the failing query carefully.
Implement if the user wants functional validation. This verifies metadata queries reflect real-time database changes.
Implement: get_test_table_identifier, create_test_table_template, insert_rows_template, add_column_template, drop_column_template, drop_test_table_template, create_lineage_query_template
All templates automatically receive {{ database }}, {{ schema }}, {{ table }} from get_test_table_identifier().
Run tests:
CONNECTOR=<name> docker compose run --rm test -m functional
After all target tests pass, run the full suite with --export:
CONNECTOR=<name> docker compose run --rm test --export
This generates output/<name>/manifest.json and output/<name>/templates/.
Report:
pass (unsupported by the database) and why/build-agent-image <name> as the next step# Run all tests
CONNECTOR=<name> docker compose run --rm test
# Run a single test file
CONNECTOR=<name> docker compose run --rm test tests/test_ql_prerequisites.py
# Run a single test
CONNECTOR=<name> docker compose run --rm test tests/test_ql_prerequisites.py::test_equality -v
When hybrid is in the arguments, follow this reduced workflow:
execute_query, fetch_all_results, close_connection (same as full)docker compose build (same as full)CustomSQLMonitorTemplates → run -m custom_monitorsQueryLanguageTemplates prerequisites → run -m ql_prerequisites-m ql_metrics--exportSkip Sections A (metadata), B (query logs), and F (functional).
Research the vendor API, implement fetch_metadata and fetch_run_details, and verify with ETL tests
Export capabilities and build a custom agent Docker image for one or more connectors
Scaffold a new connector directory with base template, manifest, credentials.json, and requirements.txt
Research the database driver, implement connection methods, stub credentials.json, and verify with connection tests