Comments (9)
Hi it seems I hit same error, while SQLight works. Using virtualenv, Python 3.5, I got this error:
bin/python bin/gtfs2db append /common/mav/ postgresql://data:fata@localhost:5432
Traceback (most recent call last):
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
psycopg2.ProgrammingError: there is no unique constraint matching given keys for referenced table "stops"
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "bin/gtfs2db", line 11, in
sys.exit(main())
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/pygtfs/gtfs2db.py", line 51, in main
schedule = Schedule(args[''])
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/pygtfs/schedule.py", line 38, in init
Base.metadata.create_all(self.engine)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/sql/schema.py", line 3949, in create_all
tables=tables)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1929, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1538, in _run_visitor
**kwargs).traverse_single(element)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single
return meth(obj, **kw)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 733, in visit_metadata
_is_metadata_operation=True)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/sql/visitors.py", line 121, in traverse_single
return meth(obj, **kw)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 767, in visit_table
include_foreign_key_constraints=include_foreign_key_constraints
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 945, in execute
return meth(self, multiparams, params)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1002, in _execute_ddl
compiled
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
context)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
exc_info
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
raise value.with_traceback(tb)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
context)
File "/common/python/gtfsdb-py35/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) there is no unique constraint matching given keys for referenced table "stops"
[SQL: '\nCREATE TABLE translations (\n\tfeed_id INTEGER, \n\ttrans_id VARCHAR NOT NULL, \n\tlang VARCHAR NOT NULL, \n\ttranslation VARCHAR, \n\tPRIMARY KEY (trans_id, lang), \n\tFOREIGN KEY(feed_id, trans_id) REFERENCES stops (feed_id, stop_name), \n\tFOREIGN KEY(feed_id) REFERENCES _feed (feed_id)\n)\n\n']
from pygtfs.
I know this is rather old, but does someone have an example of a gtfs file that fails with the most recent 0.1.4 release?
from pygtfs.
I'm closing this for now, since I don't have a reproducible testcase, and I suspect this was fixed by #44. Please feel free to reopen if this still exists.
from pygtfs.
I'm getting the same error with:
- virtualenv v16.0.0
- Python v3.7.1
- postgresql v11.1
- psycopg2 v2.7.6.1
- pygtfs @ d3b4727
- The following gtfs zip: http://www.octranspo1.com/files/google_transit.zip
from pygtfs.
OK, so this is a legitimate error, for all databases, not just postgresql.
Translations uses stop_name for the relationship, but nothing guarantees it to be unique.
This was probably introduced in #17 and somehow only postgresql complains, but all databases should have a problem with it.
from pygtfs.
This should be fixed in master right now.
from pygtfs.
Yep, works for me. Thanks!
from pygtfs.
Looks like this issue can be marked Closed.
from pygtfs.
Yep.
from pygtfs.
Related Issues (20)
- Load database from file? HOT 3
- Publish latest version on PyPI? HOT 3
- AssertionError: value outside limits - when loading in schedule HOT 2
- route_type range error from Prague's feed HOT 2
- ValueError: could not convert string to float in gtfs_entities.py HOT 5
- DeclarativeMeta object got multiple values for keyword argument 'feed_id' HOT 1
- TypeError when 'shape_dist_traveled' is empty HOT 1
- Getting validation error during the bootstrap for `location_type` not recognized HOT 1
- Unique constraint failed when trying to import the latest data from BART HOT 10
- Import fails when conditionally required route.agency_id is missing HOT 2
- pygtfs does not support UTF-8 encoding HOT 2
- Additional maintainers HOT 1
- Drop Python 2 support HOT 1
- Can not load the zip file HOT 4
- Publish 0.1.8 to pypi (and all future releases automatically) HOT 2
- Add github actions to replace broken travis
- In feeds where calendar.txt is missing, pygtfs creates entities that occur on "no day of the week" HOT 2
- Issue or Question or ?: large gtfs without calendar (only calendar_dates) HOT 2
- Load fails on feed dates missing HOT 4
- UNIQUE constraint failed: translations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pygtfs.