小编Kli*_*mud的帖子

当某些表存在时进行 Alembic 迁移

我在 alembic 中有一些迁移,并尝试运行alembic upgrade head最新的数据库进行修订,但在某些情况下,我有已经存在的表,所以我有一个错误:

alembic upgrade head
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> 3137cf88d8c6, create tables
Traceback (most recent call last):
  File "/home/toweya/.virtualenvs/numus3/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/toweya/.virtualenvs/numus3/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
psycopg2.ProgrammingError: relation "City" already exists


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/toweya/.virtualenvs/numus3/bin/alembic", line 11, in <module>
    sys.exit(main())
  File "/home/toweya/.virtualenvs/numus3/lib/python3.5/site-packages/alembic/config.py", line …
Run Code Online (Sandbox Code Playgroud)

sqlalchemy flask python-3.x alembic

6
推荐指数
1
解决办法
5659
查看次数

为什么我在 alembic 迁移方面遇到问题

项目结构(仅包含数据库迁移的目录):

--db_manage:
  alembic.ini
  --alembic:
    env.py
    script.py.mako
    README
    --versions:
      #migration files
Run Code Online (Sandbox Code Playgroud)

当我尝试运行 command: 时python db_manage/alembic/env.py,我有如下响应:

Traceback (most recent call last):
  File "db_manage/alembic/env.py", line 8, in <module>
    config = context.config
AttributeError: module 'alembic.context' has no attribute 'config'
Run Code Online (Sandbox Code Playgroud)

在哪种情况下我有这个问题?
PS
文件alembic.ini

# A generic, single database configuration.

[alembic]
# path to migration scripts
script_location = alembic

# template used to generate migration files
# file_template = %%(rev)s_%%(slug)s

# max length of characters to apply to the
# "slug" field …
Run Code Online (Sandbox Code Playgroud)

python sqlalchemy flask alembic

5
推荐指数
1
解决办法
9490
查看次数

失败:找不到修订版本

当我运行命令时

alembic revision --autogenerate -m "Reconciliation and daily amount tables"
Run Code Online (Sandbox Code Playgroud)

它给了我输出:

INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
ERROR [alembic.util.messaging] Can't locate revision identified by '67ad9835cada'
  FAILED: Can't locate revision identified by '67ad9835cada'
Run Code Online (Sandbox Code Playgroud)

问题的根源是什么?

python sqlalchemy alembic

5
推荐指数
1
解决办法
1万
查看次数

自定义文字下划线(使用+和-符号)

我需要实现自定义文本修饰,请参见下图: 自定义文字下划线设计

-用下一种样式模拟行很简单:

color: red;
border-bottom: 3px dashed; // 3px - just for example, 2.5 also looks fine.
Run Code Online (Sandbox Code Playgroud)

但是我找不到如何使用+符号实现下划线的方法。实际上,我知道有可能具有background-image,但是如果文本较长,它将不起作用。

我将不胜感激任何帮助。先感谢您。

UPD:可以使用的 简单代码段:

<main>
    <h1>Here goes some heading <span class="deleted">and this is deleted</span></h1>
    <p>And here goes more text. <span class="added">This was inserted.</span> More text <span class="deleted">This was deleted</span></p>
</main>
Run Code Online (Sandbox Code Playgroud)

html css underline text-decorations

2
推荐指数
1
解决办法
60
查看次数