sqlite3 error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Salerno

    #1

    sqlite3 error

    Here's my script:

    import sqlite3

    con = sqlite3.connect ('labdb')
    cur = con.cursor()
    cur.executescri pt('''
    DROP TABLE IF EXISTS Researchers;
    CREATE TABLE Researchers (
    researcherID varchar(9) PRIMARY KEY NOT NULL,
    birthYear int(4) DEFAULT NULL,
    birthMonth int(2) DEFAULT NULL,
    birthDay int(2) DEFAULT NULL,
    birthCountry varchar(50) DEFAULT NULL,
    birthState char(2) DEFAULT NULL,
    birthCity varchar(50) DEFAULT NULL,
    nameFirst varchar(50) NOT NULL,
    nameLast varchar(50) NOT NULL,
    nameGiven varchar(255) DEFAULT NULL,
    );
    ''')

    And here's the error:

    Traceback (most recent call last):
    File "C:\Python25\my scripts\labdb\d btest.py", line 19, in <module>
    ''')
    OperationalErro r: near ")": syntax error
    >>>
    My script looks just like the example in the docs, so I'm not sure what
    I'm doing wrong. The error message seems like it should be easy to
    figure out, but all I did was close the triple quotes and then close the
    parentheses, just like the example.

    Hope someone can shed some light on this! :)
  • Tim Chase

    #2
    Re: sqlite3 error

    import sqlite3
    >
    con = sqlite3.connect ('labdb')
    cur = con.cursor()
    cur.executescri pt('''
    DROP TABLE IF EXISTS Researchers;
    CREATE TABLE Researchers (
    researcherID varchar(9) PRIMARY KEY NOT NULL,
    birthYear int(4) DEFAULT NULL,
    birthMonth int(2) DEFAULT NULL,
    birthDay int(2) DEFAULT NULL,
    birthCountry varchar(50) DEFAULT NULL,
    birthState char(2) DEFAULT NULL,
    birthCity varchar(50) DEFAULT NULL,
    nameFirst varchar(50) NOT NULL,
    nameLast varchar(50) NOT NULL,
    nameGiven varchar(255) DEFAULT NULL,
    );
    ''')
    >
    And here's the error:
    >
    Traceback (most recent call last):
    File "C:\Python25\my scripts\labdb\d btest.py", line 19, in <module>
    ''')
    OperationalErro r: near ")": syntax error
    >>>
    >
    My script looks just like the example in the docs, so I'm not sure what
    I'm doing wrong. The error message seems like it should be easy to
    figure out, but all I did was close the triple quotes and then close the
    parentheses, just like the example.
    >
    Hope someone can shed some light on this! :)
    My guess would be the extra comma on the nameGiven line...most
    SQL engines I've used would choke on that

    - nameGiven varchar(255) DEFAULT NULL,
    + nameGiven varchar(255) DEFAULT NULL


    -tkc



    Comment

    • John Salerno

      #3
      Re: sqlite3 error

      Tim Chase wrote:
      My guess would be the extra comma on the nameGiven line...most SQL
      engines I've used would choke on that
      >
      - nameGiven varchar(255) DEFAULT NULL,
      + nameGiven varchar(255) DEFAULT NULL

      You're right! I think that must have been leftover from when it wasn't
      the last line in the query. Thanks!

      Comment

      • John Machin

        #4
        Re: sqlite3 error


        John Salerno wrote:
        CREATE TABLE Researchers (
        researcherID varchar(9) PRIMARY KEY NOT NULL,
        birthYear int(4) DEFAULT NULL,
        birthMonth int(2) DEFAULT NULL,
        birthDay int(2) DEFAULT NULL,
        birthCountry varchar(50) DEFAULT NULL,
        birthState char(2) DEFAULT NULL,
        birthCity varchar(50) DEFAULT NULL,
        nameFirst varchar(50) NOT NULL,
        nameLast varchar(50) NOT NULL,
        nameGiven varchar(255) DEFAULT NULL,
        A bit OT, but one answer to the "can you make a living with just
        Python" question is "Yup, tool of choice for rummaging in and fixing
        data that's been mangled by users cramming it into dodgy data models"
        :-)

        (1) Consider that some countries have states/provinces with 3-letter
        abbreviations (e.g. Australia) or no abbreviation than I'm aware of in
        a Latin alphabet (e.g. China).

        (2) It's not apparent how you would use the first, last, and given
        names columns, especially with two of them being "not null". Consider
        how you would store e.g.:
        J Edgar Hoover
        DJ Delorie
        Sukarno
        35
        Maggie Cheung Man-Yuk
        Molnar Janos
        Fatimah binte Rahman
        Zhang Manyu

        Cheers,
        John

        Comment

        • John Salerno

          #5
          Re: sqlite3 error

          John Machin wrote:
          John Salerno wrote:
          >CREATE TABLE Researchers (
          > researcherID varchar(9) PRIMARY KEY NOT NULL,
          > birthYear int(4) DEFAULT NULL,
          > birthMonth int(2) DEFAULT NULL,
          > birthDay int(2) DEFAULT NULL,
          > birthCountry varchar(50) DEFAULT NULL,
          > birthState char(2) DEFAULT NULL,
          > birthCity varchar(50) DEFAULT NULL,
          > nameFirst varchar(50) NOT NULL,
          > nameLast varchar(50) NOT NULL,
          > nameGiven varchar(255) DEFAULT NULL,
          >
          A bit OT, but one answer to the "can you make a living with just
          Python" question is "Yup, tool of choice for rummaging in and fixing
          data that's been mangled by users cramming it into dodgy data models"
          :-)
          >
          (1) Consider that some countries have states/provinces with 3-letter
          abbreviations (e.g. Australia) or no abbreviation than I'm aware of in
          a Latin alphabet (e.g. China).
          Good point. I guess since this program is for my own use, I just figured
          I could stick with the American style abbreviation. But it's not as if I
          actually considered that this wouldn't always work, so it's good to be
          aware of the issue.
          (2) It's not apparent how you would use the first, last, and given
          names columns, especially with two of them being "not null". Consider
          how you would store e.g.:
          J Edgar Hoover
          DJ Delorie
          Sukarno
          35
          Maggie Cheung Man-Yuk
          Molnar Janos
          Fatimah binte Rahman
          Zhang Manyu
          Not sure I follow you on some of these examples. In the case of J Edgar
          Hoover, I would just put the full name for his first name, or if "J" is
          entered, then just that, I suppose. Given name will be first name +
          middle name(s). (I took most of this schema from a baseball database, so
          maybe it's just something that worked better there.)

          Comment

          • John Salerno

            #6
            Re: sqlite3 error

            Dennis Lee Bieber wrote:
            On Wed, 27 Sep 2006 18:41:54 GMT, John Salerno
            <johnjsal@NOSPA Mgmail.comdecla imed the following in comp.lang.pytho n:
            >
            >You're right! I think that must have been leftover from when it wasn't
            >the last line in the query. Thanks!
            >
            You also, based upon the cut&paste, have a stray
            >
            "")
            >
            (or something similar in the last line)
            I don't see this. The code works now, though. Maybe it was something
            carried over by pasting.

            Comment

            • John Salerno

              #7
              Re: sqlite3 error

              Dennis Lee Bieber wrote:
              On Thu, 28 Sep 2006 14:05:16 GMT, John Salerno
              <johnjsal@NOSPA Mgmail.comdecla imed the following in comp.lang.pytho n:
              >
              >I don't see this. The code works now, though. Maybe it was something
              >carried over by pasting.
              >
              Here's a snippet from your original listing:
              >
              > nameFirst varchar(50) NOT NULL,
              > nameLast varchar(50) NOT NULL,
              > nameGiven varchar(255) DEFAULT NULL,
              >);
              >''')
              That's correct, though, isn't it? Those quotes are the closing quotes of
              the argument to executescript()

              Comment

              • John Machin

                #8
                Re: sqlite3 error

                John Salerno wrote:
                John Machin wrote:
                John Salerno wrote:
                CREATE TABLE Researchers (
                researcherID varchar(9) PRIMARY KEY NOT NULL,
                birthYear int(4) DEFAULT NULL,
                birthMonth int(2) DEFAULT NULL,
                birthDay int(2) DEFAULT NULL,
                birthCountry varchar(50) DEFAULT NULL,
                birthState char(2) DEFAULT NULL,
                birthCity varchar(50) DEFAULT NULL,
                nameFirst varchar(50) NOT NULL,
                nameLast varchar(50) NOT NULL,
                nameGiven varchar(255) DEFAULT NULL,
                A bit OT, but one answer to the "can you make a living with just
                Python" question is "Yup, tool of choice for rummaging in and fixing
                data that's been mangled by users cramming it into dodgy data models"
                :-)
                [snip]
                >
                (2) It's not apparent how you would use the first, last, and given
                names columns, especially with two of them being "not null". Consider
                how you would store e.g.:
                J Edgar Hoover
                DJ Delorie
                Sukarno
                35
                Maggie Cheung Man-Yuk
                Molnar Janos
                Fatimah binte Rahman
                Zhang Manyu
                >
                Not sure I follow you on some of these examples. In the case of J Edgar
                Hoover, I would just put the full name for his first name, or if "J" is
                entered, then just that, I suppose. Given name will be first name +
                middle name(s). (I took most of this schema from a baseball database, so
                maybe it's just something that worked better there.)
                You sure to be using "last name" to mean "surname" in the sense of
                unchanging family name e.g. John and Mary Smith are the children of
                Fred Smith, who is the son of Joe Smith.

                You would address a letter to Mary as "Dear Ms Smith", and in follow-on
                paragraphs in (say) a news article might refer to her using only the
                surname e.g. "Smith also announced ...".

                The problems are (1) there are cultures that don't have the concept of
                a surname, and if they do, it may not be the "last name" (2) the name
                may consist of only one word (giving you problems with "not null") or
                not even be a word.

                DJ Delorie -- his "given name" *is* DJ
                Sukarno -- one word name
                35 -- some jurisdictions allow name to include (or consist solely of)
                digits
                Maggie Cheung Man-Yuk -- surname is Cheung [Hong Kong romanisation]
                Molnar Janos -- surname is Molnar
                Fatimah binte Rahman -- no surname; daughter of person whose given name
                is Rahman
                Zhang Manyu -- surname is Zhang [pinyin romanisation]; same person as
                Maggie Cheung Man-Yuk

                It gets better:

                Iceland: Jon Bjornsson and Hildur Bjornsdottir are the children of
                Bjorn Eiriksson.

                Portuguese: Jose Carlos Fernandes [mothers's family name] Rodrigues
                [fathers's family name]; first step in shortening gives Jose Carlos
                Rodrigues -- no drama here, but compare with Spanish: Jose Carlos
                Fernandez [father's family name] Rodriguez [mother's family name],
                shortened to Jose Carlos Fernandez.

                [parts of] Somalia, Ethiopia: [using English given-name words for
                clarity] Tom Dick Harry and Janet Dick Harry are the children of Dick
                Harry Fred, who is the son of Harry Fred Joe.

                Vietnamese: Full name e.g. Nguyen Thi Hoa Dung -- I have seen this
                recorded as last name = Nguyen (that's the family name; doing well so
                far), but first name = Thi. Thi means "Ms" or "female". The "first
                name" is actually Dung. Given the popularity of Nguyen as a family name
                (about 50% !!) , the recorded information has narrowed the choice to
                about 25% of the Vietnamese population :-(

                Cheers,
                John

                Comment

                • Paul Rubin

                  #9
                  Re: sqlite3 error

                  "John Machin" <sjmachin@lexic on.netwrites:
                  It gets better:
                  >
                  Iceland:...
                  Portuguese:...
                  [parts of] Somalia, Ethiopia:...
                  Vietnamese:...
                  You might add something about Arabic filionyms.

                  Comment

                  • Steve Holden

                    #10
                    Re: sqlite3 error

                    John Machin wrote:
                    John Salerno wrote:
                    >
                    >>John Machin wrote:
                    >>
                    >>>John Salerno wrote:
                    >>>
                    >>>>CREATE TABLE Researchers (
                    >>> researcherID varchar(9) PRIMARY KEY NOT NULL,
                    >>> birthYear int(4) DEFAULT NULL,
                    >>> birthMonth int(2) DEFAULT NULL,
                    >>> birthDay int(2) DEFAULT NULL,
                    >>> birthCountry varchar(50) DEFAULT NULL,
                    >>> birthState char(2) DEFAULT NULL,
                    >>> birthCity varchar(50) DEFAULT NULL,
                    >>> nameFirst varchar(50) NOT NULL,
                    >>> nameLast varchar(50) NOT NULL,
                    >>> nameGiven varchar(255) DEFAULT NULL,
                    >>>
                    >>>A bit OT, but one answer to the "can you make a living with just
                    >>>Python" question is "Yup, tool of choice for rummaging in and fixing
                    >>>data that's been mangled by users cramming it into dodgy data models"
                    >>>:-)
                    >>>
                    >
                    [snip]
                    >
                    >>>(2) It's not apparent how you would use the first, last, and given
                    >>>names columns, especially with two of them being "not null". Consider
                    >>>how you would store e.g.:
                    >>>J Edgar Hoover
                    >>>DJ Delorie
                    >>>Sukarno
                    >>>35
                    >>>Maggie Cheung Man-Yuk
                    >>>Molnar Janos
                    >>>Fatimah binte Rahman
                    >>>Zhang Manyu
                    >>
                    >>Not sure I follow you on some of these examples. In the case of J Edgar
                    >>Hoover, I would just put the full name for his first name, or if "J" is
                    >>entered, then just that, I suppose. Given name will be first name +
                    >>middle name(s). (I took most of this schema from a baseball database, so
                    >>maybe it's just something that worked better there.)
                    >
                    >
                    You sure to be using "last name" to mean "surname" in the sense of
                    unchanging family name e.g. John and Mary Smith are the children of
                    Fred Smith, who is the son of Joe Smith.
                    >
                    You would address a letter to Mary as "Dear Ms Smith", and in follow-on
                    paragraphs in (say) a news article might refer to her using only the
                    surname e.g. "Smith also announced ...".
                    >
                    The problems are (1) there are cultures that don't have the concept of
                    a surname, and if they do, it may not be the "last name" (2) the name
                    may consist of only one word (giving you problems with "not null") or
                    not even be a word.
                    >
                    DJ Delorie -- his "given name" *is* DJ
                    Sukarno -- one word name
                    35 -- some jurisdictions allow name to include (or consist solely of)
                    digits
                    Maggie Cheung Man-Yuk -- surname is Cheung [Hong Kong romanisation]
                    Molnar Janos -- surname is Molnar
                    Fatimah binte Rahman -- no surname; daughter of person whose given name
                    is Rahman
                    Zhang Manyu -- surname is Zhang [pinyin romanisation]; same person as
                    Maggie Cheung Man-Yuk
                    >
                    It gets better:
                    >
                    Iceland: Jon Bjornsson and Hildur Bjornsdottir are the children of
                    Bjorn Eiriksson.
                    >
                    Portuguese: Jose Carlos Fernandes [mothers's family name] Rodrigues
                    [fathers's family name]; first step in shortening gives Jose Carlos
                    Rodrigues -- no drama here, but compare with Spanish: Jose Carlos
                    Fernandez [father's family name] Rodriguez [mother's family name],
                    shortened to Jose Carlos Fernandez.
                    >
                    [parts of] Somalia, Ethiopia: [using English given-name words for
                    clarity] Tom Dick Harry and Janet Dick Harry are the children of Dick
                    Harry Fred, who is the son of Harry Fred Joe.
                    >
                    Vietnamese: Full name e.g. Nguyen Thi Hoa Dung -- I have seen this
                    recorded as last name = Nguyen (that's the family name; doing well so
                    far), but first name = Thi. Thi means "Ms" or "female". The "first
                    name" is actually Dung. Given the popularity of Nguyen as a family name
                    (about 50% !!) , the recorded information has narrowed the choice to
                    about 25% of the Vietnamese population :-(
                    >
                    While I don't dispute any of this erudite display of esoteric
                    nomenclature wisdom the fact remains that many (predominantly Western)
                    databases do tend to use first and last name (in America often with the
                    addition of a one- or two-character "middle initial" field).

                    So, having distilled your knowledge to its essence could you please give
                    me some prescriptive advice about what I *should* do? :-)

                    regards
                    Steve
                    --
                    Steve Holden +44 150 684 7255 +1 800 494 3119
                    Holden Web LLC/Ltd http://www.holdenweb.com
                    Skype: holdenweb http://holdenweb.blogspot.com
                    Recent Ramblings http://del.icio.us/steve.holden

                    Comment

                    • John Machin

                      #11
                      Re: sqlite3 error


                      Steve Holden wrote:
                      John Machin wrote:
                      John Salerno wrote:
                      >John Machin wrote:
                      >
                      >>John Salerno wrote:
                      >>
                      >>>CREATE TABLE Researchers (
                      >> researcherID varchar(9) PRIMARY KEY NOT NULL,
                      >> birthYear int(4) DEFAULT NULL,
                      >> birthMonth int(2) DEFAULT NULL,
                      >> birthDay int(2) DEFAULT NULL,
                      >> birthCountry varchar(50) DEFAULT NULL,
                      >> birthState char(2) DEFAULT NULL,
                      >> birthCity varchar(50) DEFAULT NULL,
                      >> nameFirst varchar(50) NOT NULL,
                      >> nameLast varchar(50) NOT NULL,
                      >> nameGiven varchar(255) DEFAULT NULL,
                      >>
                      >>A bit OT, but one answer to the "can you make a living with just
                      >>Python" question is "Yup, tool of choice for rummaging in and fixing
                      >>data that's been mangled by users cramming it into dodgy data models"
                      >>:-)
                      >>
                      [snip]
                      >>(2) It's not apparent how you would use the first, last, and given
                      >>names columns, especially with two of them being "not null". Consider
                      >>how you would store e.g.:
                      >>J Edgar Hoover
                      >>DJ Delorie
                      >>Sukarno
                      >>35
                      >>Maggie Cheung Man-Yuk
                      >>Molnar Janos
                      >>Fatimah binte Rahman
                      >>Zhang Manyu
                      >
                      >Not sure I follow you on some of these examples. In the case of J Edgar
                      >Hoover, I would just put the full name for his first name, or if "J" is
                      >entered, then just that, I suppose. Given name will be first name +
                      >middle name(s). (I took most of this schema from a baseball database, so
                      >maybe it's just something that worked better there.)

                      You sure to be using "last name" to mean "surname" in the sense of
                      unchanging family name e.g. John and Mary Smith are the children of
                      Fred Smith, who is the son of Joe Smith.

                      You would address a letter to Mary as "Dear Ms Smith", and in follow-on
                      paragraphs in (say) a news article might refer to her using only the
                      surname e.g. "Smith also announced ...".

                      The problems are (1) there are cultures that don't have the concept of
                      a surname, and if they do, it may not be the "last name" (2) the name
                      may consist of only one word (giving you problems with "not null") or
                      not even be a word.

                      DJ Delorie -- his "given name" *is* DJ
                      Sukarno -- one word name
                      35 -- some jurisdictions allow name to include (or consist solely of)
                      digits
                      Maggie Cheung Man-Yuk -- surname is Cheung [Hong Kong romanisation]
                      Molnar Janos -- surname is Molnar
                      Fatimah binte Rahman -- no surname; daughter of person whose given name
                      is Rahman
                      Zhang Manyu -- surname is Zhang [pinyin romanisation]; same person as
                      Maggie Cheung Man-Yuk

                      It gets better:

                      Iceland: Jon Bjornsson and Hildur Bjornsdottir are the children of
                      Bjorn Eiriksson.

                      Portuguese: Jose Carlos Fernandes [mothers's family name] Rodrigues
                      [fathers's family name]; first step in shortening gives Jose Carlos
                      Rodrigues -- no drama here, but compare with Spanish: Jose Carlos
                      Fernandez [father's family name] Rodriguez [mother's family name],
                      shortened to Jose Carlos Fernandez.

                      [parts of] Somalia, Ethiopia: [using English given-name words for
                      clarity] Tom Dick Harry and Janet Dick Harry are the children of Dick
                      Harry Fred, who is the son of Harry Fred Joe.

                      Vietnamese: Full name e.g. Nguyen Thi Hoa Dung -- I have seen this
                      recorded as last name = Nguyen (that's the family name; doing well so
                      far), but first name = Thi. Thi means "Ms" or "female". The "first
                      name" is actually Dung. Given the popularity of Nguyen as a family name
                      (about 50% !!) , the recorded information has narrowed the choice to
                      about 25% of the Vietnamese population :-(
                      While I don't dispute any of this erudite display of esoteric
                      nomenclature wisdom the fact remains that many (predominantly Western)
                      databases do tend to use first and last name (in America often with the
                      addition of a one- or two-character "middle initial" field).
                      >
                      So, having distilled your knowledge to its essence could you please give
                      me some prescriptive advice about what I *should* do? :-)
                      >
                      Yes; the details would depend on the application (movie actor database,
                      factory payroll, pension fund, social security, homeland security, ...)
                      and should follow fairly naturally from a requirements analysis. The
                      main pre-requisite is for both the users and IT to get an attitude
                      transplant :-)

                      Cheers,
                      John

                      Cheers,
                      John

                      Comment

                      • John Salerno

                        #12
                        Re: sqlite3 error

                        John Machin wrote:
                        The problems are (1) there are cultures that don't have the concept of
                        a surname, and if they do, it may not be the "last name" (2) the name
                        may consist of only one word (giving you problems with "not null") or
                        not even be a word.
                        >
                        It gets better:
                        >
                        Iceland: Jon Bjornsson and Hildur Bjornsdottir are the children of
                        Bjorn Eiriksson
                        >
                        etc. etc.
                        Ok, you make me want to crawl under my desk and whimper until 5pm. :)

                        Fortunately my program is just a test to give me something to do, and
                        will only use the names of people already working here that happen to
                        (for the most part) fit into my model (although they *are* all foreign,
                        so it's good to keep these exceptions in mind.) And I guess it never
                        hurts to consider these things for future expansion either.

                        Comment

                        • Lawrence D'Oliveiro

                          #13
                          Re: People's names (was Re: sqlite3 error)

                          In message <mailman.912.11 59494600.10491. python-list@python.org >, Steve
                          Holden wrote:
                          John Machin wrote:
                          >
                          [lots of explanation about peculiarities of people's names]
                          >
                          While I don't dispute any of this erudite display of esoteric
                          nomenclature wisdom the fact remains that many (predominantly Western)
                          databases do tend to use first and last name (in America often with the
                          addition of a one- or two-character "middle initial" field).
                          Just because most Western designers of databases do it wrong doesn't mean
                          that a) you should do it wrong, or b) they will continue to do it wrong
                          into the future, as increasing numbers of those designers come from Asian
                          and other non-Western backgrounds.
                          So, having distilled your knowledge to its essence could you please give
                          me some prescriptive advice about what I *should* do? :-)
                          Has anyone come up with a proper universal table design for storing people's
                          names?

                          Certainly "first name" and "last name" are the wrong column names to use. I
                          think "family name" and "given names" would be a good start. For the
                          Icelanders, Somalians and the Muslims, their father's name goes in
                          the "family name" field, which makes sense because all their siblings (of
                          the same sex, at least) would have the same value in this field.

                          I wonder if we need another "middle" field for holding the "bin/binte" part
                          (could also hold, e.g. "Van" for those names that use this).

                          There would also need to be a flag field to indicate the canonical ordering
                          for writing out the full name: e.g. family-name-first, given-names-first.
                          Do we need something else for the Vietnamese case?

                          Comment

                          • John Machin

                            #14
                            Re: People's names (was Re: sqlite3 error)

                            Lawrence D'Oliveiro wrote:
                            In message <mailman.912.11 59494600.10491. python-list@python.org >, Steve
                            Holden wrote:
                            >
                            John Machin wrote:

                            [lots of explanation about peculiarities of people's names]

                            While I don't dispute any of this erudite display of esoteric
                            nomenclature wisdom the fact remains that many (predominantly Western)
                            databases do tend to use first and last name (in America often with the
                            addition of a one- or two-character "middle initial" field).
                            >
                            Just because most Western designers of databases do it wrong doesn't mean
                            that a) you should do it wrong, or b) they will continue to do it wrong
                            into the future, as increasing numbers of those designers come from Asian
                            and other non-Western backgrounds.
                            Unfortunately, lack of appreciation that different rules and customs
                            may apply on the other side of the county/state/national boundary is a
                            universal trait, not one restricted to Westerners.
                            >
                            So, having distilled your knowledge to its essence could you please give
                            me some prescriptive advice about what I *should* do? :-)
                            >
                            Has anyone come up with a proper universal table design for storing people's
                            names?
                            >
                            Certainly "first name" and "last name" are the wrong column names to use.I
                            think "family name" and "given names" would be a good start.
                            So far so good.
                            For the
                            Icelanders, Somalians and the Muslims, their father's name goes in
                            the "family name" field, which makes sense because all their siblings (of
                            the same sex, at least) would have the same value in this field.
                            Two problems so far:
                            (1) If you then assume that you should print the phone directory in
                            order of family name, that's not appropriate in some places e.g.
                            Iceland; neither is addressing Jon Jonsson as "Mr Jonsson", and BTW it
                            can be their mother's name e.g. if she has more fame or recognition
                            than their father.
                            (2) Arabic names: you may or may not have their father's name. You
                            might not even have the [usually only one] given name. For example: the
                            person who was known as Abu Musab al-Zarqawi: this means "father of
                            Musab, the man from Zarqa [a city in Jordan]". You may have the family
                            name as well as the father's and grandfather's given name. You can have
                            the occupation, honorifics, nicknames. For a brief overview, read this:

                            >
                            I wonder if we need another "middle" field for holding the "bin/binte" part
                            (could also hold, e.g. "Van" for those names that use this).
                            Not a good idea, IMHO. Consider "Nguyen Van Tran" vs 'Rembrandt van
                            Rijn". Would you peel the Da off Da Costa but not the D' off
                            D'Oliveiro? What do you do with the bod who fills in a form as Dermot
                            O'Sullivan one month and Diarmaid Ó Súilleabháin the next?
                            >
                            There would also need to be a flag field to indicate the canonical ordering
                            for writing out the full name: e.g. family-name-first, given-names-first.
                            Do we need something else for the Vietnamese case?
                            As I said before, it depends on the application. In some applications,
                            it will be preferable to capture, in one field, the whole name as
                            supplied by the person, together with clues like nationality and place
                            of birth that will help in parsing it later. However if all you want to
                            do is post out the electricity bill to an address that your
                            meter-reader has verified, then you can afford to be a little casual
                            with the name.

                            This is all a bit OT. Before we close the thread down, let me leave
                            you with one warning:
                            Beware of enthusiastic maintenance programmers on a mission to clean up
                            the dirty names in your database:
                            E.g. (1) "Karim bin Md" may not appreciate getting a letter addressed
                            to "Dr Karim Bin" (Md is an abbreviation of Muhammad).
                            E.g. (2) Billing job barfs on a customer who has no given names and no
                            family name. Inspection reveals that he is over-endowed in the title
                            department: "Mr Earl King".

                            Cheers,
                            John

                            Comment

                            • Steve Holden

                              #15
                              Re: People's names (was Re: sqlite3 error)

                              Lawrence D'Oliveiro wrote:
                              In message <mailman.912.11 59494600.10491. python-list@python.org >, Steve
                              Holden wrote:
                              >
                              >
                              >>John Machin wrote:
                              >>
                              >>[lots of explanation about peculiarities of people's names]
                              >>
                              >>While I don't dispute any of this erudite display of esoteric
                              >>nomenclatur e wisdom the fact remains that many (predominantly Western)
                              >>databases do tend to use first and last name (in America often with the
                              >>addition of a one- or two-character "middle initial" field).
                              >
                              >
                              Just because most Western designers of databases do it wrong doesn't mean
                              that a) you should do it wrong, or b) they will continue to do it wrong
                              into the future, as increasing numbers of those designers come from Asian
                              and other non-Western backgrounds.
                              >
                              I quite agree: my comment was really intended to highlight the fact that
                              most Western database designers (myself included) do tend to be quite
                              locale-centric. I haven't any experience with Eastern design, so can't
                              say whether the same holds true.
                              >
                              >>So, having distilled your knowledge to its essence could you please give
                              >>me some prescriptive advice about what I *should* do? :-)
                              >
                              >
                              Has anyone come up with a proper universal table design for storing people's
                              names?
                              >
                              Certainly "first name" and "last name" are the wrong column names to use. I
                              think "family name" and "given names" would be a good start. For the
                              Icelanders, Somalians and the Muslims, their father's name goes in
                              the "family name" field, which makes sense because all their siblings (of
                              the same sex, at least) would have the same value in this field.
                              >
                              I wonder if we need another "middle" field for holding the "bin/binte" part
                              (could also hold, e.g. "Van" for those names that use this).
                              >
                              There would also need to be a flag field to indicate the canonical ordering
                              for writing out the full name: e.g. family-name-first, given-names-first.
                              Do we need something else for the Vietnamese case?
                              You'd think some standards body would have worked on this, wouldn't you.
                              I couldn't think of a Google search string that would lead to such
                              information, though. Maybe other, more determined, readers can do better.

                              regards
                              Steve
                              --
                              Steve Holden +44 150 684 7255 +1 800 494 3119
                              Holden Web LLC/Ltd http://www.holdenweb.com
                              Skype: holdenweb http://holdenweb.blogspot.com
                              Recent Ramblings http://del.icio.us/steve.holden

                              Comment

                              Working...