0
我需要在datetime列SQLalchemy連接兩個表,但我不想考慮完整的日期時間,但只有日期部分(加入兩個具有相似日期的行即使這些日子的時間不相等)。加入日期SQLalchemy考慮只有日期而不是一天中的時間
這是我現在所擁有的
import sqlalchemy as sq
...
first = meta.tables["schema.first"]
second = meta.tables["schema.second"]
select = sq.select([
first.c.id,
first.c.date,
first.c.value,
second.c.value])
.select_from(first.join(second, sq.and_(
first.c.id == second.c.id,
first.c.date == second.c.date
# exact match between datetimes is currently needed
)))
你跑什麼數據庫? –
這是一個PostgreSQL數據庫 –