%PDF- %PDF-
Direktori : /proc/self/root/opt/alt/python27/lib/python2.7/site-packages/alembic/ |
Current File : //proc/self/root/opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyc |
� �M!Vc @ s� d d l m Z d d l m Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d e f d � � YZ d e f d � � YZ d d d � Z e d k r� e � n d S( i����( t ArgumentParseri ( t SafeConfigParserN( t command( t util( t package_dir( t compatt Configc B s� e Z d Z d d d e j d e j � d d � Z d Z d Z d Z e j d � � Z d � Z e j d � � Z d � Z d � Z d � Z d � Z d � Z d d � Z d d � Z RS( sk Represent an Alembic configuration. Within an ``env.py`` script, this is available via the :attr:`.EnvironmentContext.config` attribute, which in turn is available at ``alembic.context``:: from alembic import context some_param = context.config.get_main_option("my option") When invoking Alembic programatically, a new :class:`.Config` can be created by passing the name of an .ini file to the constructor:: from alembic.config import Config alembic_cfg = Config("/path/to/yourapp/alembic.ini") With a :class:`.Config` object, you can then run Alembic commands programmatically using the directives in :mod:`alembic.command`. The :class:`.Config` object can also be constructed without a filename. Values can be set programmatically, and new sections will be created as needed:: from alembic.config import Config alembic_cfg = Config() alembic_cfg.set_main_option("script_location", "myapp:migrations") alembic_cfg.set_main_option("url", "postgresql://foo/bar") alembic_cfg.set_section_option("mysection", "foo", "bar") For passing non-string values to environments, such as connections and engines, use the :attr:`.Config.attributes` dictionary:: with engine.begin() as connection: alembic_cfg.attributes['connection'] = connection command.upgrade(alembic_cfg, "head") :param file_: name of the .ini file to open. :param ini_section: name of the main Alembic section within the .ini file :param output_buffer: optional file-like input buffer which will be passed to the :class:`.MigrationContext` - used to redirect the output of "offline generation" when using Alembic programmatically. :param stdout: buffer where the "print" output of commands will be sent. Defaults to ``sys.stdout``. .. versionadded:: 0.4 :param config_args: A dictionary of keys and values that will be used for substitution in the alembic config file. The dictionary as given is **copied** to a new one, stored locally as the attribute ``.config_args``. When the :attr:`.Config.file_config` attribute is first invoked, the replacement variable ``here`` will be added to this dictionary before the dictionary is passed to ``SafeConfigParser()`` to parse the .ini file. .. versionadded:: 0.7.0 :param attributes: optional dictionary of arbitrary Python keys/values, which will be populated into the :attr:`.Config.attributes` dictionary. .. versionadded:: 0.7.5 .. seealso:: :ref:`connection_sharing` t alembicc C sY | | _ | | _ | | _ | | _ | | _ t | � | _ | rU | j j | � n d S( s* Construct a new :class:`.Config` N( t config_file_namet config_ini_sectiont output_buffert stdoutt cmd_optst dictt config_argst attributest update( t selft file_t ini_sectionR R R R R ( ( s? /opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyt __init__U s c C s i S( s A Python dictionary for storage of additional state. This is a utility dictionary which can include not just strings but engines, connections, schema objects, or anything else. Use this to pass objects into an env.py script, such as passing a :class:`sqlalchemy.engine.base.Connection` when calling commands from :mod:`alembic.command` programmatically. .. versionadded:: 0.7.5 .. seealso:: :ref:`connection_sharing` :paramref:`.Config.attributes` ( ( R ( ( s? /opt/alt/python27/lib/python2.7/site-packages/alembic/config.pyR } s c G s'