Thanks, but if I need allow nullable primary_keys it not works.
I tried:
user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='SET
NULL'), primary_key=True, nullable=True, server_default=text('NULL'))
it generates
CREATE TABLE user_ip (
user_id INTEGER DEFAULT NULL,
PRIMARY KEY
On 11/11/2011 11:20 AM, Alex K wrote:
Thanks, but if I need allow nullable primary_keys it not works.
I tried:
user_id = db.Column(db.Integer, db.ForeignKey('user.id
http://user.id', ondelete='SET NULL'), primary_key=True,
nullable=True, server_default=text('NULL'))
A primary key can never
Hi,
I have two models, A and B. Model B contains two foreign keys into table
A, because it is a comparator model that describes certain logical
interaction between two A models. However, I want model B to contain a
relationship to both so I can access them through the model B instance:
Oh, sorry, my mistake.
Can I create table in sqlalchemy without primary key?
class UserIp(db.Model, UnicodeMixin):
__tablename__ = 'user_ip'
user_id = db.Column(db.Integer, db.ForeignKey('user.id', ondelete='SET
NULL'))
ip = db.Column(postgres.CIDR, nullable=False, server_default='
Ah, so, thanks. My logic was that I could specify which foreign_key to
use for the relationship, which is basically a subset of primaryjoin
condition, but in my opinion cleaner. So, that wouldn't work? I must
use always use primaryjoin?
I was looking at few paragraphs below, under