# 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:** 1\
**Showing post:** 4

<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

---

_[View the full topic](https://community.dynatrace.com/t/getting-error-method-query-keyerror-url-in-python-ef2-based-extensiton/47253)._
