Python Get Specific Substring From The End Sql