Created
October 21, 2011 17:19
-
-
Save batok/1304382 to your computer and use it in GitHub Desktop.
When using clear_mappers is executed , celery mappings also got cleared
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@task | |
def columns( table = "usuarios"): | |
try: | |
t = Table( table , metadata, autoload = True, autoload_with = engine) | |
try: | |
clear_mappers() # this clean all previous mappers if any | |
mapper( Dummy, t ) | |
except: | |
traceback.print_exc() | |
return "error" | |
result = ["Table {} ( {} recs)".format(table, session.query( Dummy ).count())] | |
for x in metadata.tables[table].columns: | |
result.append("{:<40s} {}".format( x.name, x.type)) | |
return "\n".join(result) | |
except: | |
traceback.print_exc() | |
return "error" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment