Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81475

Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'schema': 0.05; 'subject:Python': 0.06; 'mysql,': 0.07; 'postgresql': 0.07; 'alter': 0.09; 'connect,': 0.09; 'definition,': 0.09; 'postgresql,': 0.09; 'present,': 0.09; 'referenced': 0.09; 'statements': 0.09; 'subject:2.7': 0.09; 'cc:addr:python-list': 0.11; 'stored': 0.12; '"default': 0.16; "(it's": 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'wrote:': 0.18; 'basically': 0.19; 'items.': 0.19; 'select': 0.22; 'handles': 0.22; 'rules': 0.22; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'config': 0.24; 'lets': 0.24; 'of.': 0.24; 'connected': 0.24; 'mon,': 0.24; 'server.': 0.24; 'cc:2**0': 0.24; 'this:': 0.26; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'feature': 0.29; 'am,': 0.29; 'related': 0.29; 'database,': 0.30; 'primarily': 0.30; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'url:wiki': 0.31; '(maybe': 0.31; '25,': 0.31; "company's": 0.31; 'names.': 0.31; 'url:wikipedia': 0.31; 'anyone': 0.31; 'probably': 0.32; 'figure': 0.32; 'table': 0.34; 'sense': 0.34; 'something': 0.35; 'requirement': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; '+0200,': 0.36; 'data,': 0.36; 'impression': 0.36; 'useful': 0.36; 'similar': 0.36; 'url:org': 0.36; 'example,': 0.37; 'application': 0.37; 'two': 0.37; 'skip:o 20': 0.38; 'nov': 0.38; 'others.': 0.38; 'needed': 0.38; 'that,': 0.38; 'explain': 0.39; 'does': 0.39; 'itself': 0.39; 'skip:. 10': 0.39; 'called': 0.40; 'consists': 0.60; 'referred': 0.60; 'most': 0.60; 'full': 0.61; 'act': 0.63; 'such': 0.63; 'choose': 0.64; 'pick': 0.64; 'different': 0.65; 'within': 0.65; 'here': 0.66; 'between': 0.67; 'default': 0.69; 'qualified': 0.72; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=1mpKPpr+nqGvPbxVQwra09U3s8LTYLy6KSLKcDBuyiM=; b=npVW1jZDDXdbmeqrAXAXi1v6Fgt8zWwrov0dClKsl5CaO7GhWupODk7GX8PDI+nYKx P2sqWX5IHJl346l+S4HSfqkXX9He2eNICAUIjZ5NaG6T5kGubua4xHNqrwofk+0H5zRu oEW5mdxJFx0/oyhE/XiyL7lbb5uv7hW45NuJiWAOovftdgcqqSVUeUB6x4AhS77yJr9f pLq32TXP26O0p6cqw9r6mqchFtC0FTmPmfvvwWwCN5O3bMjttfZujr+ZWapYq6TLgCx4 m+est2E8RfDxQEvxO1pHZqShrz1/RsFk9RlvMgJXzArMpIM+6Fpqy8FkTQw+DQLumHv5 SjTQ==
MIME-Version 1.0
X-Received by 10.107.17.79 with SMTP id z76mr20693504ioi.27.1416871072522; Mon, 24 Nov 2014 15:17:52 -0800 (PST)
In-Reply-To <lrr67al6ppa852agu9rq2dstqtue17iiem@4ax.com>
References <ca987fb8-157d-4612-bafa-5da2da2920e0@googlegroups.com> <mailman.16153.1416709340.18130.python-list@python.org> <5d474a87-e2a5-43d3-b07c-4a1194880b4d@googlegroups.com> <54716987.7040301@gmail.com> <mailman.16159.1416721303.18130.python-list@python.org> <ea4e3af8-f173-4706-ba4e-4eca9d701e40@googlegroups.com> <CAPTjJmp4Y5zowWn5yFtJutKO4H5jVtqLaNtWqEpA6B35xNdsNA@mail.gmail.com> <m4s5er$sg1$1@ger.gmane.org> <8d747a5biq4rc559tvgju088508bp0o2gv@4ax.com> <m4uork$6h5$1@ger.gmane.org> <lrr67al6ppa852agu9rq2dstqtue17iiem@4ax.com>
Date Tue, 25 Nov 2014 10:17:52 +1100
Subject Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16259.1416871079.18130.python-list@python.org> (permalink)
Lines 55
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416871079 news.xs4all.nl 2921 [2001:888:2000:d::a6]:52420
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81475

Show key headers only | View raw


On Tue, Nov 25, 2014 at 5:44 AM, Dennis Lee Bieber
<wlfraed@ix.netcom.com> wrote:
> On Mon, 24 Nov 2014 10:05:11 +0200, "Frank Millman" <frank@chagford.com>
> declaimed the following:
>
>>I will explain why such a feature would have been useful for me.
>>
>>My accounting system handles multiple companies. I needed to figure out a
>>way to keep each one's data separate from the others.
>>
>>Originally I supported two databases - PostgreSQL and Sql Server. They both
>>have a concept called 'schemas', which handles my requirement elegantly -
>>each company's data is stored in its own schema.
>>
>
>         We must have a different impression of what a "schema" consists of. As
> I learned it, the "schema" basically came down to the statements defining
> the form of the data, the rules (triggers) on it, and the relationships
> between data items. http://en.wikipedia.org/wiki/Database_schema
>
>         By that definition, SQLite3 does support "schemas" (it's all the DDL
> statements used to create the database less the data itself -- which are
> DML). So does Firebird, MySQL, Access/JET

The sense here is one of qualified names. In DB2 and PostgreSQL, you
can create a database, and then within that, create schemas. You
choose a database when you connect, and then you can write code like
this:

select customer_name, invoice_date from accts.invoices join
crm.customers on (customer_id = crm.customers.id) where blah blah

The table names are qualified with their schema names. You can also
have a "default schema", which is the one used for unqualified table
names, which lets you pick one from a group of related data sets: for
example, Frank's accounting system would probably make use of that,
such that the code needn't care after startup. It'll just select a
default schema (or, in PostgreSQL, alter the search_path), and then
most of the code will just use unqualified names. Any data that's not
company-specific (maybe the application stores UI config data in the
database too) can be stored in a dedicated schema and referenced by
qualified name.

Technically, a table can be referred to as
database_name.schema_name.table_name (and then you can add
.column_name after that, but I have NEVER seen anyone use the full
four-parter!), but in PostgreSQL, the database_name, if present, must
be the one that you connected to. In MySQL, there these things that
are kinda databases and kinda schemas, are referred to by both names,
and in terms of data separation, primarily act like schemas. In
SQLite3, there are basically no schemas, AIUI, but you can use
databases to do something similar - with the originally-mentioned
limitation.

ChrisA

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-22 18:11 -0800
  Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-23 13:22 +1100
    Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-22 19:54 -0800
      Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Michael Torrie <torriem@gmail.com> - 2014-11-22 21:58 -0700
      Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-23 16:41 +1100
        Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-22 22:08 -0800
          Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-23 17:32 +1100
            Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-22 22:46 -0800
            Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Christian Gollwitzer <auriocus@gmx.de> - 2014-11-23 10:55 +0100
          Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert "Frank Millman" <frank@chagford.com> - 2014-11-23 10:21 +0200
            Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-23 17:29 -0800
          Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-23 19:31 +1100
            Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2014-11-23 11:40 +0200
              Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-23 20:53 +1100
          Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-23 13:01 -0500
          Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert "Frank Millman" <frank@chagford.com> - 2014-11-24 10:05 +0200
          Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-24 13:44 -0500
          Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-25 10:17 +1100
          Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert "Frank Millman" <frank@chagford.com> - 2014-11-25 07:31 +0200
          Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-25 17:40 +1100
  Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-23 11:58 -0500
  Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert llanitedave <llanitedave@birdandflower.com> - 2014-11-23 18:22 -0800
    Re: SQLite3 in Python 2.7 Rejecting Foreign Key Insert Chris Angelico <rosuav@gmail.com> - 2014-11-24 15:49 +1100

csiph-web