# Getting error Method=query: KeyError('url') in python EF2 based extensiton

**URL:** <https://community.dynatrace.com/t/getting-error-method-query-keyerror-url-in-python-ef2-based-extensiton/47253>\
**Category:** Extensions\
**Tags:** databases, extensions\
**Created:** [August 21, 2024, 10:16pm UTC](https://community.dynatrace.com/t/getting-error-method-query-keyerror-url-in-python-ef2-based-extensiton/47253 "2024-08-21T22:16:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinaykorlepara1](https://avatars.discourse-cdn.com/v4/letter/v/e56c9b/32.png) [@vinaykorlepara1](https://community.dynatrace.com/u/vinaykorlepara1)\
**Post date:** [August 21, 2024, 10:16pm UTC](https://community.dynatrace.com/t/getting-error-method-query-keyerror-url-in-python-ef2-based-extensiton/47253/1 "2024-08-21T22:16:19Z")

</div>

Hi everyone,

I recently converted a generic database plugin from EF1 to EF2. After building and uploading the plugin to the environment, I’m encountering the following error message in the logs: “Method=query: KeyError(‘url’)”. Could anyone please help me identify the cause of this error?

Thank you!

---

<div class="post-metadata">

**Author:** ![jannickdeturck](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@jannickdeturck](https://community.dynatrace.com/u/jannickdeturck)\
**Post date:** [October 11, 2024, 12:36pm UTC](https://community.dynatrace.com/t/getting-error-method-query-keyerror-url-in-python-ef2-based-extensiton/47253/2 "2024-10-11T12:36:07Z")

</div>

I have the same issue. Is there any feedback / help related to this issue, available please?

---

<div class="post-metadata">

**Author:** ![david\_lopes](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/david_lopes/32/27273_2.png) [@david\_lopes](https://community.dynatrace.com/u/david_lopes)\
**Post date:** [October 11, 2024, 10:37pm UTC](https://community.dynatrace.com/t/getting-error-method-query-keyerror-url-in-python-ef2-based-extensiton/47253/3 "2024-10-11T22:37:02Z")

</div>

Are you positive you “converted” the entire extension? That includes rewriting the source code as well.

That error message means that the code is looking for a property called “url” that doesn’t exist in the activation schema.

Converting database extensions means creating a SQL Datasource extension, it should not involve python at all unless you are 100% sure of what you are doing.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [October 11, 2024, 10:52pm UTC](https://community.dynatrace.com/t/getting-error-method-query-keyerror-url-in-python-ef2-based-extensiton/47253/4 "2024-10-11T22:52:52Z")

</div>

When creating a python extension in VS Code, the following code is automatically generated inside query():

```markup
for endpoint in self.activation_config["endpoints"]:
            url = endpoint["url"]
            user = endpoint["user"]
            password = endpoint["password"]
            self.logger.debug(f"Running endpoint with url '{url}'")

```

The error you are getting is because of the second line above. You have to tweak the code. But, as [@david\_lopes](https://community.dynatrace.com/user/4044) , you shouldn’t be getting that error when dealing with a SQL datasource extension.

If you are migrating from custom.db.query, use the “custom extensions creator” app

---

<div class="post-metadata">

**Author:** ![AmayShah](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@AmayShah](https://community.dynatrace.com/u/AmayShah)\
**Post date:** [March 7, 2025, 1:23pm UTC](https://community.dynatrace.com/t/getting-error-method-query-keyerror-url-in-python-ef2-based-extensiton/47253/5 "2025-03-07T13:23:23Z")

</div>

Hi Antonio,  
What if we are using a managed version of Dynatrace and do not have access to the “Custom Extensions Creator?”
