Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix rdbms_db_summary #1409

Merged
merged 3 commits into from
Apr 13, 2024
Merged

fix rdbms_db_summary #1409

merged 3 commits into from
Apr 13, 2024

Conversation

yyhhyyyyyy
Copy link
Contributor

@yyhhyyyyyy yyhhyyyyyy commented Apr 11, 2024

Description

Fix the issue where the program cannot start when using a PostgreSQL database.

2024-04-11 23:55:09 PC-20240108PCVE dbgpt.rag.summary.db_summary_client[6704] WARNING django, postgresql summary error!tuple indices must be integers or slices, not str, detail: Traceback (most recent call last):
  File "\dbgpt\rag\summary\db_summary_client.py", line 74, in init_db_summary
    self.db_summary_embedding(item["db_name"], item["db_type"])
  File "\dbgpt\rag\summary\db_summary_client.py", line 42, in db_summary_embedding
    db_summary_client = RdbmsSummary(dbname, db_type)
  File "\dbgpt\rag\summary\rdbms_db_summary.py", line 48, in __init__
    self.table_info_summaries = [
  File "\dbgpt\rag\summary\rdbms_db_summary.py", line 49, in <listcomp>
    self.get_table_summary(table_name) for table_name in tables
  File "\dbgpt\rag\summary\rdbms_db_summary.py", line 59, in get_table_summary
    return _parse_table_summary(self.db, self.summary_template, table_name)
  File "\dbgpt\rag\summary\rdbms_db_summary.py", line 107, in _parse_table_summary
    key_str = ", ".join(index_key["column_names"])
TypeError: tuple indices must be integers or slices, not str

How Has This Been Tested?

python examples/sdk/chat_data_with_awel.py but please use a PostgreSQL database connection like this:

db_conn = PostgreSQLConnector.from_uri_db(
    host="localhost",
    port=5432,
    user="postgres",
    password="123",
    db_name="db"
)

Snapshots:

Please test directly.

Checklist:

  • My code follows the style guidelines of this project
  • I have already rebased the commits and make the commit message conform to the project standard.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules

@github-actions github-actions bot added the fix Bug fixes label Apr 11, 2024
@fangyinc
Copy link
Collaborator

Hi, @yyhhyyyyyy, thank you for your contribution, but the current unit test does not pass, please fix it.

Fix the issue where `rdbms_db_summary` cannot properly return database information when SQL is PostgreSQL in `_parse_table_summary`.
@yyhhyyyyyy
Copy link
Contributor Author

@fangyinc , I have already fixed this issue. Please test it.

Copy link
Collaborator

@fangyinc fangyinc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Collaborator

@csunny csunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

@csunny csunny merged commit f3ece62 into eosphoros-ai:main Apr 13, 2024
2 checks passed
Hopshine pushed a commit to Hopshine/DB-GPT that referenced this pull request Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants