Submits a command to the server without waiting for the result(s). getresult () send_query - executes a SQL command string asynchronously ¶ Connection. query ( "select phone from employees where name=$1", ( name ,)). Of this error by reading its sqlstate attribute. When the database could not process the query, a pg.ProgrammingError orĪ pg.InternalError is raised. Return value for the last command in this case. Multiple SQL commands (separated by semicolons). If you don’t pass any parameters, the command string can also include The database in such a way that they don’t need to be escaped, making thisĪn effective way to pass arbitrary or unknown data without worrying about $1, $2, etc instead of literal data, in which case the values The SQL command may optionally contain positional parameters of the form Object to show the query results on the console. Or Query.namedresult() or Query.namediter() if you want to Query.dictiter() if you want to get the rows as dictionaries, Alternatively, you can call Query.dictresult() or You can use the Query object as an iterator that yields all resultsĪs tuples, or call Query.getresult() to get the result as a list returning" statement), this method returns Rows as a result (usually a select statement, but maybe also an Of rows affected is returned as a string. If the query is an update or delete statement, or an insert statement thatĭid not insert exactly one row, or on a table without OIDs, then the number The return value is the OID of the newly inserted row as an integer. Insert statement that inserted exactly one row into a table that has OIDs, This method simply sends a SQL query to the database. Pg.InternalError – error during query processing ValueError – empty SQL query or lost connection TypeError – bad argument type, or too many arguments query – execute a SQL command string ¶ Connection. Set the large_objects option in the Python setup file. If you want to forbid access to these from the module, (refer to PostgreSQL user manual for more information about these). Some other methods give access to large objects
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |