Python alembic.context.get_x_argument() Examples
The following are 30
code examples of alembic.context.get_x_argument().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
alembic.context
, or try the search function
.
Example #1
Source File: env.py From stampython with GNU General Public License v3.0 | 6 votes |
def run_migrations_offline(): """Run migrations in 'offline' mode. This configures the context with just a URL and not an Engine, though an Engine is acceptable here as well. By skipping the Engine creation we don't even need a DBAPI to be available. Calls to context.execute() here emit the given string to the script output. """ # if a database path was provided, override the one in alembic.ini database = context.get_x_argument(as_dictionary=True).get('database') if database: url = "sqlite:///%s" % database else: url = config.get_main_option("sqlalchemy.url") context.configure( url=url, target_metadata=target_metadata, literal_binds=True) with context.begin_transaction(): context.run_migrations()
Example #2
Source File: f5237c7e2374_create_scep_config_table.py From commandment with MIT License | 5 votes |
def downgrade(): # if context.get_x_argument(as_dictionary=True).get('data', None): # data_downgrades() schema_downgrades()
Example #3
Source File: d5b32b5cc74e_add_dep_profile_id_to_device.py From commandment with MIT License | 5 votes |
def downgrade(): # if context.get_x_argument(as_dictionary=True).get('data', None): # data_downgrades() schema_downgrades()
Example #4
Source File: e947cdf82307_add_ios_installed_application_fields.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #5
Source File: e947cdf82307_add_ios_installed_application_fields.py From commandment with MIT License | 5 votes |
def downgrade(): # if context.get_x_argument(as_dictionary=True).get('data', None): # data_downgrades() schema_downgrades()
Example #6
Source File: 2808deb9fc62_create_dep_configurations.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #7
Source File: 6675e981817e_create_available_os_updates_table.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #8
Source File: 6675e981817e_create_available_os_updates_table.py From commandment with MIT License | 5 votes |
def downgrade(): # if context.get_x_argument(as_dictionary=True).get('data', None): # data_downgrades() schema_downgrades()
Example #9
Source File: a3ddaad5c358_add_dep_device_columns.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #10
Source File: a3ddaad5c358_add_dep_device_columns.py From commandment with MIT License | 5 votes |
def downgrade(): # if context.get_x_argument(as_dictionary=True).get('data', None): # data_downgrades() schema_downgrades()
Example #11
Source File: 3fb4a904979c_general_cleanup.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #12
Source File: f5237c7e2374_create_scep_config_table.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #13
Source File: 1005dc7dea01_os_update_settings.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #14
Source File: 7ab500f58a76_create_installed_payloads.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #15
Source File: 7ab500f58a76_create_installed_payloads.py From commandment with MIT License | 5 votes |
def downgrade(): # if context.get_x_argument(as_dictionary=True).get('data', None): # data_downgrades() schema_downgrades()
Example #16
Source File: e78274be170e_create_organizations_table.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #17
Source File: a2e0af380181_create_dep_profiles.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #18
Source File: a2e0af380181_create_dep_profiles.py From commandment with MIT License | 5 votes |
def downgrade(): # if context.get_x_argument(as_dictionary=True).get('data', None): # data_downgrades() schema_downgrades()
Example #19
Source File: f029ac1af3f0_create_vpp_accounts.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #20
Source File: f029ac1af3f0_create_vpp_accounts.py From commandment with MIT License | 5 votes |
def downgrade(): # if context.get_x_argument(as_dictionary=True).get('data', None): # data_downgrades() schema_downgrades()
Example #21
Source File: env.py From stampython with GNU General Public License v3.0 | 5 votes |
def run_migrations_online(): """Run migrations in 'online' mode. In this scenario we need to create an Engine and associate a connection with the context. """ # get the alembic section of the config file ini_section = config.get_section(config.config_ini_section) # if a database path was provided, override the one in alembic.ini database = context.get_x_argument(as_dictionary=True).get('database') if database: ini_section['sqlalchemy.url'] = "sqlite:///%s" % database else: ini_section = config.get_section(config.config_ini_section) connectable = engine_from_config( ini_section, prefix='sqlalchemy.', poolclass=pool.NullPool) with connectable.connect() as connection: context.configure( connection=connection, target_metadata=target_metadata ) with context.begin_transaction(): context.run_migrations()
Example #22
Source File: 212_add_columns_for_smtp_imap_specific_auth.py From sync-engine with GNU Affero General Public License v3.0 | 5 votes |
def upgrade(): conn = op.get_bind() conn.execute(text("set @@lock_wait_timeout = 20;")) conn.execute(text("set @@foreign_key_checks = 0;")) # Add new columns + ForeignKey constraints. shard_id = int(context.get_x_argument(as_dictionary=True).get('shard_id')) if shard_id == 0: conn.execute(text("ALTER TABLE genericaccount " "ADD COLUMN imap_username CHAR(255) DEFAULT NULL, " "ADD COLUMN smtp_username CHAR(255) DEFAULT NULL, " "ADD COLUMN imap_password_id INT(11), " "ADD COLUMN smtp_password_id INT(11), " "ADD CONSTRAINT imap_password_id_ifbk FOREIGN KEY " "(`imap_password_id`) REFERENCES `secret` (`id`), " "ADD CONSTRAINT smtp_password_id_ifbk FOREIGN KEY " "(`smtp_password_id`) REFERENCES `secret` (`id`);")) else: conn.execute(text("ALTER TABLE genericaccount " "ADD COLUMN imap_username CHAR(255) DEFAULT NULL, " "ADD COLUMN smtp_username CHAR(255) DEFAULT NULL, " "ADD COLUMN imap_password_id BIGINT(20), " "ADD COLUMN smtp_password_id BIGINT(20), " "ADD CONSTRAINT imap_password_id_ifbk FOREIGN KEY " "(`imap_password_id`) REFERENCES `secret` (`id`), " "ADD CONSTRAINT smtp_password_id_ifbk FOREIGN KEY " "(`smtp_password_id`) REFERENCES `secret` (`id`);"))
Example #23
Source File: 8c866896f76e_create_dep_join_tables.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #24
Source File: env.py From ether_sql with Apache License 2.0 | 5 votes |
def get_url(): "Database URL must be specified on command line with -x url=<DB_URL>" url = context.get_x_argument(as_dictionary=True).get('url') return url
Example #25
Source File: 1005dc7dea01_os_update_settings.py From commandment with MIT License | 5 votes |
def downgrade(): # if context.get_x_argument(as_dictionary=True).get('data', None): # data_downgrades() schema_downgrades()
Example #26
Source File: 875dcce0bf8b_create_vpp_users.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #27
Source File: 875dcce0bf8b_create_vpp_users.py From commandment with MIT License | 5 votes |
def downgrade(): # if context.get_x_argument(as_dictionary=True).get('data', None): # data_downgrades() schema_downgrades()
Example #28
Source File: 2f1507bf6dc1_create_application_manifests_table.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #29
Source File: 0201b96ab856_add_ios_available_os_updates_fields.py From commandment with MIT License | 5 votes |
def upgrade(): schema_upgrades() # if context.get_x_argument(as_dictionary=True).get('data', None): # data_upgrades()
Example #30
Source File: 0201b96ab856_add_ios_available_os_updates_fields.py From commandment with MIT License | 5 votes |
def downgrade(): # if context.get_x_argument(as_dictionary=True).get('data', None): # data_downgrades() schema_downgrades()