タグ

関連タグで絞り込む (0)

  • 関連タグはありません

タグの絞り込みを解除

pythonとPythonとrelationに関するanimistのブックマーク (3)

  • 最近覚えたSQLAlchemyのTips

    先週は、レガシーなOracleデータベースと格闘していた(文字エンコーディングの件もその一つ)。 __table__と__tablename__の違い __table__は適切に設定済みのテーブルに対して使うらしい。自分でごちゃごちゃと設定したい場合は__tablename__と__table_args__を使うべし How to override a column name in sqlalchemy using reflection and descriptive syntax 複合プライマリーキーでのone-to-many 主キーが複合プライマリーキーの場合はそれぞれにprimary_key=Trueをつけるが、外部キーで一対多の関連付けをしたい場合には __table_args__で外部キー設定をしておく。 class Protocol(Base): __tablename__ =

    最近覚えたSQLAlchemyのTips
  • ぽよメモ

    背景 ArgoCDでGitOpsしているとします。ここで誤ってkube-system namespaceリソースを一度管理下に入れてpushし、revertしたとしましょう。このようにArgoCDが同期しているリソースが同期元から消えたとき、設定によって以下の2パターンのどちらかの挙動となります。 prune: true のとき 同期していたリソースの削除を自動的に試みる。リソースの削除が完了するとSyncedステータスになる。 prune: false のとき 同期していたリソースは削除されず、該当リソースの削除待ち状態となりApplicationリソースは OutOfSyncステータスになる。 手動で該当リソースを削除するとSyncedステータスになる。 まず前者の状態になるといきなり詰む可能性があります。基的に使わない方がよいでしょう*1。 後者の場合、kube-system na

    ぽよメモ
  • Basic Relationship Patterns — SQLAlchemy 2.0 Documentation

    Basic Relationship Patterns¶ A quick walkthrough of the basic relational patterns, which in this section are illustrated using Declarative style mappings based on the use of the Mapped annotation type. The setup for each of the following sections is as follows: from __future__ import annotations from typing import List from sqlalchemy import ForeignKey from sqlalchemy import Integer from sqlalchem

  • 1