Git Product home page Git Product logo

Comments (9)

KAMI911 avatar KAMI911 commented on August 11, 2024

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.

jarondl avatar jarondl commented on August 11, 2024

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.

jarondl avatar jarondl commented on August 11, 2024

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.

chimo avatar chimo commented on August 11, 2024

I'm getting the same error with:

from pygtfs.

jarondl avatar jarondl commented on August 11, 2024

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.

jarondl avatar jarondl commented on August 11, 2024

This should be fixed in master right now.

from pygtfs.

chimo avatar chimo commented on August 11, 2024

Yep, works for me. Thanks!

from pygtfs.

jimbudarz avatar jimbudarz commented on August 11, 2024

Looks like this issue can be marked Closed.

from pygtfs.

jarondl avatar jarondl commented on August 11, 2024

Yep.

from pygtfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.