예제 #1
0
 def test_quote_value(self):
     mock_engine = Mock()
     quotable_value = Mock()
     mock_preparer = mock_engine.dialect.preparer.return_value
     quoted = quoting.quote_value(mock_engine, quotable_value)
     self.assertEqual(mock_preparer.quote.return_value, quoted)
     mock_preparer.quote.assert_called_with(quotable_value)
     mock_engine.dialect.preparer.assert_called_with(mock_engine.dialect,
                                                     initial_quote="'")
예제 #2
0
 def quote(value: str) -> str:
     return quote_value(db_engine, value)
예제 #3
0
 def aws_creds_sql(self, aws_id: str, aws_secret: str) -> str:
     return """
         ALTER SESSION SET UDPARAMETER FOR awslib aws_id={aws_id};
         ALTER SESSION SET UDPARAMETER FOR awslib aws_secret={aws_secret};
     """.format(aws_id=quote_value(self.db.engine, aws_id),
                aws_secret=quote_value(self.db.engine, aws_secret))