Bug #87777 | Wrong explanation for Row.get_string() and weird usage | ||
---|---|---|---|
Submitted: | 15 Sep 2017 14:17 | Modified: | 18 Jun 2018 21:46 |
Reporter: | Shahriyar Rzayev | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / Python | Severity: | S2 (Serious) |
Version: | 8.0.4 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[15 Sep 2017 14:17]
Shahriyar Rzayev
[20 Sep 2017 12:14]
MySQL Verification Team
Hello Shahriyar, Thank you for the report and feedback. Thanks, Umesh
[20 Sep 2017 14:11]
Nuno Mariz
Hi Shahriyar, The documentation of 'get_string()' is not clear. The 'mysqlx.Row.get_string()' returns the value of the column name provided. For example, if you have: command = "select count(*) as total from {}.{}" You can: self.session.sql(command.format(schema_name, table_name)) result = sql.execute() for row in result.fetch_all(): print(row.get_string("total")) or print(row["total"]) Since you have only on column in the SQL query, you also can do row[0] (by index). We will update the reference documentation regarding this method. Thank you.
[18 Jun 2018 21:46]
Philip Olson
Posted by developer: Fixed as of the upcoming MySQL Connector/Python 8.0.12 release, and here's the changelog entry: Deprecated the Row.get_string() method in favor of __getitem__. Thank you for the documentation bug report, which ultimately lead to deprecating the method.