cockroachdb / cockroachdb/docs

sqlalchemy example should just use cockroachdb and not postgresql in the connection string

オープン
#15,992 コメント 2 件 リアクション 0 件 担当者 1 名 @ianjevans が担当を希望しています GitHub で見る
C-doc-improvement
主要言語
HTML
スター
212
フォーク
476
平均マージ
40分
マージ済み PR(30日)
3

説明

Dikshant Adhikari (dikshant) commented:

I was a little confused by this example in our sqlalchemy docs and saw [someone in the community](https://cockroachdb.slack.com/archives/CP4D9LD5F/p1673446709408379] getting indirectly confused due to this.
```python3
if __name__ == '__main__':
# For cockroach demo:
# DATABASE_URL=postgresql://demo:@127.0.0.1:26257?sslmode=require
# For CockroachCloud:
# DATABASE_URL=postgresql://:@:26257/.defaultdb?sslmode=verify-full&sslrootcert=/
db_uri = os.environ['DATABASE_URL'].replace("postgresql://", "cockroachdb://")
try:
```
I don’t see a good reason to do this string substitution here. We should just have:
```python3
if __name__ == '__main__':
# For cockroach demo:
# DATABASE_URL=cockroachdb://demo:@127.0.0.1:26257?sslmode=require
# For CockroachCloud:
# DATABASE_URL=cockroachdb://:@:26257/.defaultdb?sslmode=verify-full&sslrootcert=/
db_uri = os.environ['DATABASE_URL')
try:
```
Because the UI already shows `cockroachdb://`
Screenshot 2023-01-12 at 2 09 15 PM

Also can we make it explicitly clear in a highlighted that when using SQLAlchemy the connection string should start with `cockroachdb` and not `postgres`.
See: https://github.com/cockroachdb/sqlalchemy-cockroachdb#install-and-usage

Jira Issue: DOC-6587

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。