Reflected NUMERIC columns lose their precision and scale
メンテナーはふだん 4 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 65/100
調査の方向性
Look at the reflection code in the dialect, likely in a file like dialect.py or reflection.py. The issue mentions reading from information_schema.columns; find where column types are constructed. You'll need to add reading of numeric_precision and numeric_scale when both are present. Test with a CrateDB instance to ensure the reflected column retains its precision and scale. Check for any existing tests for numeric column reflection.
索引モデルが issue の本文から書いたものです。
説明
When SQLAlchemy reflects a table, this dialect reads each column's type from information_schema.columns. It asks only for data_type, which holds the bare type name: numeric (and nothing else). The precision and scale sit in two other columns, numeric_precision and numeric_scale, which the dialect never reads. So the column comes back as a bare NUMERIC:
reflected NUMERIC(10, 2) NUMERIC()
Two things go wrong because of it:
- The read value is correct, but its form changes slightly: SQLAlchemy formats it with the column's scale, and without one it falls back to ten decimal places.
read a stored 1.25 Decimal('1.2500000000') # reads with default 10 precision
- Creating the column needs the precision, because crate refuses a
NUMERICcolumn without one, so the dialect raisesCompileErrorbefore sending the DDL.
CREATE TABLE from it CompileError: CrateDB stores a NUMERIC column only with a precision, as in Numeric(precision=10, scale=2)
crate reports the precision today and that we could implement immediately (in theory), but the scale only comes with crate/crate#20275, which is planned for 6.4.6, so the dialect's reflection should read both (this ticket) only once it ships.
Also, it should only use them only when both are present.
An older server reports NUMERIC(10, 2) as precision 10 with a null scale, and reading that as NUMERIC(10) would drop the decimals of copied tables.
Arrays of NUMERIC report neither value even with that fix (see the example here => so reflected arrays stay without precision for now.
- 主要言語
- Python
- スター
- 9
- フォーク
- 6
- 平均マージ
- 6日 13時間
- マージ済み PR(30日)
- 8
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crate/sqlalchemy-cratedb のほかの issue
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
crate/sqlalchemy-cratedb#310 ·
メンテナーはふだん 4 日以内に返信
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
crate/sqlalchemy-cratedb#308 ·
メンテナーはふだん 4 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
crate/sqlalchemy-cratedb#284 · コメント 3 件 ·
メンテナーはふだん 4 日以内に返信
-
Refactor rewrite_update() for cleaner bind parameter key representation再び着手できるかも @bgunebakan が 175 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
crate/sqlalchemy-cratedb#270 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 4 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
crate/sqlalchemy-cratedb#269 ·
メンテナーはふだん 4 日以内に返信
crate/sqlalchemy-cratedb の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
hugohe3/ppt-master#366 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 89/100
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
521xueweihan/HelloGitHub#4716 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
pcqpcq/open-source-android-apps#619 ·
メンテナーはふだん 1 日以内に返信
-
contribution Windows 主机
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Lee-xeo/Claude-Cage#1519 ·
メンテナーはふだん 1 日以内に返信