タグ

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

タグの絞り込みを解除

sqlalchemyと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
  • ぽよメモ

    TL; DR おうちサーバも監視したい SaaS 比較検討 Mackerel Datadog Elastic Cloud NewRelic Grafana Cloud セットアップ Grafana Cloudのアカウント作成 Grafana Agentのインストールとセットアップ cAdvisorを建てる cAdvisorのメトリクスを参照する Grafana Cloudで表示する ダッシュボードを作る ログを検索する 無料枠を超えないために Promtailの設定にリミットを入れる scraping intervalを広めにとる 不要なメトリクスやlabelをdropする アラートを仕掛ける 注意点 まとめ TL; DR Grafana Cloudは無料枠が大きく個人でも使いやすい メトリクス・ログ・アラートに加えトレースまで扱える Grafana Agentをnon-rootで動かして

    ぽよメモ
  • 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