스키마에 대한 주석이 sqlalchemy를 통해 작동하지 않는 이유를 모르겠지만 psql 콘솔에서 완벽하게 작동합니다.
다양한 설정을 시도했지만 여전히 운이 없으며 스키마가 생성되지만 설명을 추가 할 수 없습니다.
import sqlalchemy
engine = sqlalchemy.create_engine('postgresql://postgres@localhost/posgres')
engine.execute("CREATE SCHEMA IF NOT EXISTS myschema")
engine.execute("COMMENT ON SCHEMA myschema IS 'Seemly Random Description'")
psql로 확인
postgres=# \dn+
List of schemas
Name │ Owner │ Access privileges │ Description
──────────┼──────────┼──────────────────────┼────────────────────────
myschema │ postgres │ │
public │ postgres │ postgres=UC/postgres↵│ standard public schema
│ │ =UC/postgres │
(2 rows)
이유는 확실하지 않지만 연결을 만들고 실행하면 작동하는 것 COMMIT
같습니다.
In [8]: conn = engine.connect()
In [9]: conn.execute("COMMENT ON SCHEMA myschema IS 'Seemly Random Description'")
Out[9]: <sqlalchemy.engine.result.ResultProxy at 0x7fd109991cd0>
In [10]: conn.execute("COMMIT;")
Out[10]: <sqlalchemy.engine.result.ResultProxy at 0x7fd0ff3b7d10>
postgres=# \dn+
List of schemas
Name | Owner | Access privileges | Description
----------+----------+----------------------+---------------------------
myschema | postgres | | Seemly Random Description
public | postgres | postgres=UC/postgres+| standard public schema
| | =UC/postgres |
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다