Python sqlalchemy.sql.util._repr_params() Examples
The following are 15
code examples of sqlalchemy.sql.util._repr_params().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sqlalchemy.sql.util
, or try the search function
.
Example #1
Source File: test_logging.py From sqlalchemy with MIT License | 6 votes |
def test_repr_params_positional_list(self): # given non-multi-params in a list. repr params with # per-element truncation, mostly does the exact same thing eq_( repr( sql_util._repr_params( [[i for i in range(300)], 5], batches=10, max_chars=80, ismulti=False, ) ), "[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 ... " "(1310 characters truncated) ... " "292, 293, 294, 295, 296, 297, 298, 299], 5]", )
Example #2
Source File: test_logging.py From sqlalchemy with MIT License | 6 votes |
def test_repr_params_ismulti_named_dict(self): # given non-multi-params in a list. repr params with # per-element truncation, mostly does the exact same thing param = {"key_%s" % i: i for i in range(10)} eq_( repr( sql_util._repr_params( [param for j in range(50)], batches=5, max_chars=80, ismulti=True, ) ), "[%(param)r, %(param)r, %(param)r ... " "displaying 5 of 50 total bound parameter sets ... " "%(param)r, %(param)r]" % {"param": param}, )
Example #3
Source File: test_logging.py From sqlalchemy with MIT License | 6 votes |
def test_repr_params_ismulti_list(self): # given multi-params in a list. repr params with # per-element truncation, mostly does the exact same thing eq_( repr( sql_util._repr_params( [ [[i for i in range(300)], 5], [[i for i in range(300)], 5], [[i for i in range(300)], 5], ], batches=10, max_chars=80, ismulti=True, ) ), "[[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 ... " "(1310 characters truncated) ... 292, 293, 294, 295, 296, 297, " "298, 299], 5], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 ... " "(1310 characters truncated) ... 292, 293, 294, 295, 296, 297, " "298, 299], 5], [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1 ... " "(1310 characters truncated) ... 292, 293, 294, 295, 296, 297, " "298, 299], 5]]", )
Example #4
Source File: exc.py From jbox with MIT License | 5 votes |
def __str__(self): from sqlalchemy.sql import util details = [SQLAlchemyError.__str__(self)] if self.statement: details.append("[SQL: %r]" % self.statement) if self.params: params_repr = util._repr_params(self.params, 10) details.append("[parameters: %r]" % params_repr) return ' '.join([ "(%s)" % det for det in self.detail ] + details)
Example #5
Source File: exc.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def __str__(self): from sqlalchemy.sql import util details = [SQLAlchemyError.__str__(self)] if self.statement: details.append("[SQL: %r]" % self.statement) if self.params: params_repr = util._repr_params(self.params, 10) details.append("[parameters: %r]" % params_repr) return ' '.join([ "(%s)" % det for det in self.detail ] + details)
Example #6
Source File: exc.py From planespotter with MIT License | 5 votes |
def __str__(self): from sqlalchemy.sql import util details = [self._message()] if self.statement: details.append("[SQL: %r]" % self.statement) if self.params: params_repr = util._repr_params(self.params, 10) details.append("[parameters: %r]" % params_repr) code_str = self._code_str() if code_str: details.append(code_str) return ' '.join([ "(%s)" % det for det in self.detail ] + details)
Example #7
Source File: exc.py From pyRevit with GNU General Public License v3.0 | 5 votes |
def __str__(self): from sqlalchemy.sql import util details = [SQLAlchemyError.__str__(self)] if self.statement: details.append("[SQL: %r]" % self.statement) if self.params: params_repr = util._repr_params(self.params, 10) details.append("[parameters: %r]" % params_repr) return ' '.join([ "(%s)" % det for det in self.detail ] + details)
Example #8
Source File: exc.py From stdm with GNU General Public License v2.0 | 5 votes |
def __str__(self): from sqlalchemy.sql import util params_repr = util._repr_params(self.params, 10) return ' '.join([ "(%s)" % det for det in self.detail ] + [ SQLAlchemyError.__str__(self), repr(self.statement), repr(params_repr) ])
Example #9
Source File: exc.py From sqlalchemy with MIT License | 5 votes |
def _sql_message(self, as_unicode): from sqlalchemy.sql import util details = [self._message(as_unicode=as_unicode)] if self.statement: if not as_unicode and not compat.py3k: stmt_detail = "[SQL: %s]" % compat.safe_bytestring( self.statement ) else: stmt_detail = "[SQL: %s]" % self.statement details.append(stmt_detail) if self.params: if self.hide_parameters: details.append( "[SQL parameters hidden due to hide_parameters=True]" ) else: params_repr = util._repr_params( self.params, 10, ismulti=self.ismulti ) details.append("[parameters: %r]" % params_repr) code_str = self._code_str() if code_str: details.append(code_str) return "\n".join(["(%s)" % det for det in self.detail] + details)
Example #10
Source File: test_logging.py From sqlalchemy with MIT License | 5 votes |
def test_repr_params_large_list_of_dict(self): eq_( repr( sql_util._repr_params( [{"data": str(i)} for i in range(100)], batches=10, ismulti=True, ) ), "[{'data': '0'}, {'data': '1'}, {'data': '2'}, {'data': '3'}, " "{'data': '4'}, {'data': '5'}, {'data': '6'}, {'data': '7'}" " ... displaying 10 of 100 total bound " "parameter sets ... {'data': '98'}, {'data': '99'}]", )
Example #11
Source File: test_logging.py From sqlalchemy with MIT License | 5 votes |
def test_repr_params_positional_array(self): eq_( repr( sql_util._repr_params( [[1, 2, 3], 5], batches=10, ismulti=False ) ), "[[1, 2, 3], 5]", )
Example #12
Source File: test_logging.py From sqlalchemy with MIT License | 5 votes |
def test_repr_params_unknown_list(self): # not known if given multiparams or not. repr params with # straight truncation eq_( repr( sql_util._repr_params( [[i for i in range(300)], 5], batches=10, max_chars=80 ) ), "[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... " "(1315 characters truncated) ... , 293, 294, 295, 296, " "297, 298, 299], 5]", )
Example #13
Source File: exc.py From jarvis with GNU General Public License v2.0 | 5 votes |
def __str__(self): from sqlalchemy.sql import util details = [self._message()] if self.statement: details.append("[SQL: %r]" % self.statement) if self.params: params_repr = util._repr_params(self.params, 10) details.append("[parameters: %r]" % params_repr) code_str = self._code_str() if code_str: details.append(code_str) return ' '.join([ "(%s)" % det for det in self.detail ] + details)
Example #14
Source File: exc.py From moviegrabber with GNU General Public License v3.0 | 5 votes |
def __str__(self): from sqlalchemy.sql import util params_repr = util._repr_params(self.params, 10) return ' '.join([ "(%s)" % det for det in self.detail ] + [ SQLAlchemyError.__str__(self), repr(self.statement), repr(params_repr) ])
Example #15
Source File: exc.py From android_universal with MIT License | 5 votes |
def __str__(self): from sqlalchemy.sql import util details = [self._message()] if self.statement: details.append("[SQL: %r]" % self.statement) if self.params: params_repr = util._repr_params(self.params, 10) details.append("[parameters: %r]" % params_repr) code_str = self._code_str() if code_str: details.append(code_str) return ' '.join([ "(%s)" % det for det in self.detail ] + details)