
In SQLA 0.9 there is now a native .quote attribute on many objects. Conditionally use this instead of the old method if the attribute exists, to remove deprecation messages (and prepare for when the other way will be fully removed). Change-Id: I3c5fada13e044c1c4102acc0455226ce1524f2e2
11 lines
211 B
Python
11 lines
211 B
Python
"""
|
|
Safe quoting method
|
|
"""
|
|
|
|
def safe_quote(obj):
|
|
# this is the SQLA 0.9 approach
|
|
if hasattr(obj, 'name') and hasattr(obj.name, 'quote'):
|
|
return obj.name.quote
|
|
else:
|
|
return obj.quote
|