langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
35.43k stars 4.22k forks source link

SQL Query component doesn't work #4662

Closed SavvySupport closed 6 days ago

SavvySupport commented 6 days ago

Bug Description

When I try to run a query, it gives me an error: 'SQLExecutorComponent' object has no attribute 'set_event_manager'

Reproduction

  1. Using the "SQL Query" component, enter in DB URL, and query.
  2. Run the component
  3. It provides the following error message:

'SQLExecutorComponent' object has no attribute 'set_event_manager'

Traceback (most recent call last): File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/api/v1/chat.py", line 227, in _build_vertex vertex_build_result = await graph.build_vertex( File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/graph/graph/base.py", line 1419, in build_vertex await vertex.build( File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/graph/vertex/base.py", line 818, in build await step(user_id=user_id, event_manager=event_manager, **kwargs) File "/langflow1.1.0/venv1.1.0/lib/python3.10/site-packages/langflow/graph/vertex/base.py", line 493, in _build self.custom_component.set_event_manager(event_manager) AttributeError: 'SQLExecutorComponent' object has no attribute 'set_event_manager'

Expected behavior

Expected to return the queried results.

Who can help?

No response

Operating System

MacOS

Langflow Version

1.1

Python Version

3.10

Screenshot

No response

Flow File

No response

dosubot[bot] commented 6 days ago

The error you're encountering is due to the SQLExecutorComponent not having a set_event_manager method. This method is typically used to associate an EventManager instance with a component, allowing it to handle events like messages or logs [1].

To resolve this issue, you need to ensure that the SQLExecutorComponent class implements the set_event_manager method. This method should assign the provided EventManager instance to an attribute within the component, enabling it to utilize the event manager's functionality for event handling.

Here's a basic example of how you might implement this method in the SQLExecutorComponent class:

class SQLExecutorComponent(CustomComponent):
    # existing attributes and methods

    def set_event_manager(self, event_manager):
        self.event_manager = event_manager

By adding this method, the SQLExecutorComponent will be able to handle events as expected, and the error should be resolved.

To continue talking to Dosu, mention @dosu.

SavvySupport commented 6 days ago

Thanks @ogabrielluiz ! When will these fixes be pushed?