Best Python code snippet using localstack_python
0078_add_columns_for_disk_usage_accounting.py
1"""2Migration script to add 'total_size' column to the dataset table, 'purged'3column to the HDA table, and 'disk_usage' column to the User and GalaxySession4tables.5"""6from sqlalchemy import *7from sqlalchemy.orm import *8from migrate import *9from migrate.changeset import *10import logging11log = logging.getLogger( __name__ )12metadata = MetaData( migrate_engine )13db_session = scoped_session( sessionmaker( bind=migrate_engine, autoflush=False, autocommit=True ) )14def upgrade():15 print __doc__16 metadata.reflect()17 try:18 Dataset_table = Table( "dataset", metadata, autoload=True )19 c = Column( 'total_size', Numeric( 15, 0 ) )20 c.create( Dataset_table )21 assert c is Dataset_table.c.total_size22 except Exception, e:23 print "Adding total_size column to dataset table failed: %s" % str( e )24 log.debug( "Adding total_size column to dataset table failed: %s" % str( e ) )25 try:26 HistoryDatasetAssociation_table = Table( "history_dataset_association", metadata, autoload=True )27 c = Column( "purged", Boolean, index=True, default=False )28 c.create( HistoryDatasetAssociation_table )29 assert c is HistoryDatasetAssociation_table.c.purged30 db_session.execute(HistoryDatasetAssociation_table.update().values(purged=False))31 except Exception, e:32 print "Adding purged column to history_dataset_association table failed: %s" % str( e )33 log.debug( "Adding purged column to history_dataset_association table failed: %s" % str( e ) )34 try:35 User_table = Table( "galaxy_user", metadata, autoload=True )36 c = Column( 'disk_usage', Numeric( 15, 0 ), index=True )37 c.create( User_table )38 assert c is User_table.c.disk_usage39 except Exception, e:40 print "Adding disk_usage column to galaxy_user table failed: %s" % str( e )41 log.debug( "Adding disk_usage column to galaxy_user table failed: %s" % str( e ) )42 try:43 GalaxySession_table = Table( "galaxy_session", metadata, autoload=True )44 c = Column( 'disk_usage', Numeric( 15, 0 ), index=True )45 c.create( GalaxySession_table )46 assert c is GalaxySession_table.c.disk_usage47 except Exception, e:48 print "Adding disk_usage column to galaxy_session table failed: %s" % str( e )49 log.debug( "Adding disk_usage column to galaxy_session table failed: %s" % str( e ) )50def downgrade():51 metadata.reflect()52 try:53 Dataset_table = Table( "dataset", metadata, autoload=True )54 Dataset_table.c.total_size.drop()55 except Exception, e:56 print "Dropping total_size column from dataset table failed: %s" % str( e )57 log.debug( "Dropping total_size column from dataset table failed: %s" % str( e ) )58 try:59 HistoryDatasetAssociation_table = Table( "history_dataset_association", metadata, autoload=True )60 HistoryDatasetAssociation_table.c.purged.drop()61 except Exception, e:62 print "Dropping purged column from history_dataset_association table failed: %s" % str( e )63 log.debug( "Dropping purged column from history_dataset_association table failed: %s" % str( e ) )64 try:65 User_table = Table( "galaxy_user", metadata, autoload=True )66 User_table.c.disk_usage.drop()67 except Exception, e:68 print "Dropping disk_usage column from galaxy_user table failed: %s" % str( e )69 log.debug( "Dropping disk_usage column from galaxy_user table failed: %s" % str( e ) )70 try:71 GalaxySession_table = Table( "galaxy_session", metadata, autoload=True )72 GalaxySession_table.c.disk_usage.drop()73 except Exception, e:74 print "Dropping disk_usage column from galaxy_session table failed: %s" % str( e )...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!