Skip to content

Commit

Permalink
Merge pull request #59 from Atsu06/add_translation
Browse files Browse the repository at this point in the history
add  translation.py to load 'translations.txt' into database
  • Loading branch information
fpurcell authored Apr 20, 2023
2 parents f28aac7 + 632c430 commit 2382d10
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gtfsdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from gtfsdb.model.stop_feature import * # noqa
from gtfsdb.model.stop_time import StopTime # noqa
from gtfsdb.model.transfer import Transfer # noqa
from gtfsdb.model.translation import Translation # noqa
from gtfsdb.model.trip import Trip # noqa
from gtfsdb.model.block import Block # noqa

Expand Down Expand Up @@ -42,6 +43,7 @@
FareAttribute.__name__,
FareRule.__name__,
UniversalCalendar.__name__,
Translation.__name__,
]


Expand Down
21 changes: 21 additions & 0 deletions gtfsdb/model/translation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from sqlalchemy import Column, Integer, Sequence
from sqlalchemy.types import String

from gtfsdb import config
from gtfsdb.model.base import Base


class Translation(Base):
datasource = config.DATASOURCE_GTFS
filename = 'translations.txt'

__tablename__ = 'translations'

id = Column(Integer, Sequence(None, optional=True), primary_key=True)
table_name = Column(String(255), nullable=False)
field_name = Column(String(255), nullable=False)
language = Column(String(255), nullable=False)
translation = Column(String(255), nullable=False)
record_id = Column(String(255))
record_sub_id = Column(String(255))
field_value = Column(String(255))

0 comments on commit 2382d10

Please sign in to comment.