§ }<ˆjŒžãóx—ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z dd lm Z dd lm Z dd lm Z dd lm Z dd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZerBddlmZddlm Z ddl!m"Z"ddlm#Z#ddlm$Z$ddlm%Z%ddl&m'Z'dd l(m)Z)dd!l*m+Z+dd"l,m-Z-dd#l.m/Z/e ee0ee0d$ffZ1eeee0e0fed%gd&fZ2ee0ed'gee0ed(ffZ3ed)Z4e ed*e e0fZ5ee e0e4e5ge6fZ7ed+e e0e4e6e d+ge6fZ8eed,eee e0efgd&fZ9eed-d-e e0e ee e0ge e6fZ:Gd.„d/ej;¦«Z—| ¦«jjS)a‚Return True if the context is configured to expect a transactional DDL capable backend. This defaults to the type of database in use, and can be overridden by the ``transactional_ddl`` argument to :meth:`.configure` This function requires that a :class:`.MigrationContext` has first been made available via :meth:`.configure`. )Ú get_contextÚimplÚtransactional_ddlr?s r:Úis_transactional_ddlz'EnvironmentContext.is_transactional_ddlÜs€ð×ÒÑ!Ô!Ô&Ô8Ð8r<có,—| ¦« SrC)rKr?s r:Úrequires_connectionz&EnvironmentContext.requires_connectionês€Ø×'Ò'Ñ)Ô)Ð)Ð)r<Ú _RevNumbercó6—|j d¦«S)a¦Return the hex identifier of the 'head' script revision. If the script directory has multiple heads, this method raises a :class:`.CommandError`; :meth:`.EnvironmentContext.get_head_revisions` should be preferred. This function does not require that the :class:`.MigrationContext` has been configured. .. seealso:: :meth:`.EnvironmentContext.get_head_revisions` Úhead©r3Úas_revision_numberr?s r:Úget_head_revisionz$EnvironmentContext.get_head_revisionís€ðŒ{×-Ò-¨fÑ5Ô5Ð5r<có6—|j d¦«S)aReturn the hex identifier of the 'heads' script revision(s). This returns a tuple containing the version number of all heads in the script directory. This function does not require that the :class:`.MigrationContext` has been configured. ÚheadsrVr?s r:Úget_head_revisionsz%EnvironmentContext.get_head_revisionsüs€ðŒ{×-Ò-¨gÑ6Ô6Ð6r<cóö—|j�1|j | ¦«j¦«Sd|jvr%|j |jd¦«St jd¦«‚)aTReturn the 'starting revision' argument, if the revision was passed using ``start:end``. This is only meaningful in "offline" mode. Returns ``None`` if no value is available or was configured. This function does not require that the :class:`.MigrationContext` has been configured. NÚ starting_revz+No starting revision argument is available.)r1r3rWrMÚ_start_from_revr8rÚ CommandErrorr?s r:Úget_starting_revision_argumentz1EnvironmentContext.get_starting_revision_argumentsˆ€ð Ô "Ð .Ø”;×1Ò1Ø× Ò Ñ"Ô"Ô2ñôð ð˜tÔ0Ð 0Ð 0Ø”;×1Ò1ØÔ! .Ô1ñôð õÔ#Ø=ñôð r<cóL—|j |jd¦«S)a�Get the 'destination' revision argument. This is typically the argument passed to the ``upgrade`` or ``downgrade`` command. If it was specified as ``head``, the actual version number is returned; if specified as ``base``, ``None`` is returned. This function does not require that the :class:`.MigrationContext` has been configured. Údestination_rev)r3rWr8r?s r:Úget_revision_argumentz(EnvironmentContext.get_revision_argument%s*€ðŒ{×-Ò-Ø Ô Ð/Ô 0ñ ô ð r<ú Optional[str]có8—|j dd¦«S)agReturn the value passed for the ``--tag`` argument, if any. The ``--tag`` argument is not used directly by Alembic, but is available for custom ``env.py`` configurations that wish to use it; particularly for offline generation scripts that wish to generate tagged filenames. This function does not require that the :class:`.MigrationContext` has been configured. .. seealso:: :meth:`.EnvironmentContext.get_x_argument` - a newer and more open ended system of extending ``env.py`` scripts via the command line. ÚtagNrIr?s r:Úget_tag_argumentz#EnvironmentContext.get_tag_argument7s€ð$Ô ×$Ò$ U¨DÑ1Ô1Ð1r<Ú as_dictionaryúLiteral[False]ú List[str]có—dSrC©©r9rhs r:Úget_x_argumentz!EnvironmentContext.get_x_argumentKó€à ˆr<ú Literal[True]úDict[str, str]có—dSrCrlrms r:rnz!EnvironmentContext.get_x_argumentOror<.ú Union[List[str], Dict[str, str]]có—dSrCrlrms r:rnz!EnvironmentContext.get_x_argumentSs €ð ˆr<Fcó€—|jj�|jjjpg}ng}|rtd„|D¦«¦«}|S)aµReturn the value(s) passed for the ``-x`` argument, if any. The ``-x`` argument is an open ended flag that allows any user-defined value or values to be passed on the command line, then available here for consumption by a custom ``env.py`` script. The return value is a list, returned directly from the ``argparse`` structure. If ``as_dictionary=True`` is passed, the ``x`` arguments are parsed using ``key=value`` format into a dictionary that is then returned. For example, to support passing a database URL on the command line, the standard ``env.py`` script can be modified like this:: cmd_line_url = context.get_x_argument( as_dictionary=True).get('dbname') if cmd_line_url: engine = create_engine(cmd_line_url) else: engine = engine_from_config( config.get_section(config.config_ini_section), prefix='sqlalchemy.', poolclass=pool.NullPool) This then takes effect by running the ``alembic`` script as:: alembic -x dbname=postgresql://user:pass@host/dbname upgrade head This function does not require that the :class:`.MigrationContext` has been configured. .. seealso:: :meth:`.EnvironmentContext.get_tag_argument` :attr:`.Config.cmd_opts` Nc3óBK—|]}| dd¦«V—ŒdS)ú=rN)Úsplit)Ú.0rAs r:ú z4EnvironmentContext.get_x_argument..‡s0èè€Ð<Ð<¨s˜Ÿš 3¨Ñ*Ô*Ð<Ð<Ð<Ð<Ð<ÐràsðØ"Ð"Ð"Ð"Ð"Ð"àÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØ!Ð!Ð!Ð!Ð!Ð!ØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØ!Ð!Ð!Ð!Ð!Ð!ØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØÐÐÐÐÐØ Ð Ð Ð Ð Ð ØÐÐÐÐÐà(Ð(Ð(Ð(Ð(Ð(Ø.Ð.Ð.Ð.Ð.Ð.Ø%Ð%Ð%Ð%Ð%Ð%à(Ð(Ð(Ð(Ð(Ð(Ø'Ð'Ð'Ð'Ð'Ð'ØÐÐÐÐÐØ#Ð#Ð#Ð#Ð#Ð#àð .à%Ð%Ð%Ð%Ð%Ð%Ø1Ð1Ð1Ð1Ð1Ð1Ø5Ð5Ð5Ð5Ð5Ð5Ø.Ð.Ð.Ð.Ð.Ð.Ø0Ð0Ð0Ð0Ð0Ð0à(Ð(Ð(Ð(Ð(Ð(Ø1Ð1Ð1Ð1Ð1Ð1ØÐÐÐÐÐØ!Ð!Ð!Ð!Ð!Ð!Ø1Ð1Ð1Ð1Ð1Ð1Ø-Ð-Ð-Ð-Ð-Ð-à �e˜C  s¨C x¤Ð0Ô1Ô 2€ à%Ø�u˜S #˜X”¨Ð-?Ô(@ÐAÀ4ÐGôÐð؈#ÐÐ  %¨¨W°U¬^Ð(;Ô"<Ð<ô€ ððô€ð'Ø Ð FÔGØ ˆS„MðôÐðØ ˆc„]�NÐ$9Ð:¸DÐ@ô€ ðàØ�Œ ØØ Ø�Ôð ð ð ô €ðØ�¨ °3¬¸ÀÀcÀÔ9JÐKØð ôÐð  àØØØ�Œ Ø�ÔØ�Œ ð ð ˆT„Nðô Ððh'ðh'ðh'ðh'ðh'˜Ô,ñh'ôh'ðh'ðh'ðh'r<