Re: Different ways of working against a SQLite3 dB

2009-02-16 Thread Karen Tracey
On Mon, Feb 16, 2009 at 3:53 PM, DaSa  wrote:

>
>
> Thx for your tips!
>
> I tried to update my Python version but it did not work.
>

Updating Python failed?  Or changing to 2.6 did not affect your problem?


>
> Today I have my data in an Excel document, and I have a script that
> parse the excel document and creates sql-commands that I paste in the
> SQL shell. But as you know I have the problem with swedish signs.


Well, you haven't actually said what the problems are, you just said "the
windows command prompt does not support swedish signs."  But then later you
said that you do use chcp to set the encoding in the command prompt and the
symbols appear properly, but aren't handled properly when you use "python
manage.py shell", specifically, which rather well matches my experience with
that Python issue.  Now you say "the SQL shell" and I'm not sure if you mean
the sqlite program or manage.py shell, so I'm a bit confused.  Perhaps if
you gave some specific details it would help.  What codepage do you use for
chcp, what exact commands are you issuing in the (and which) shell, what is
the result?  If the problem isn't fixed by that Python issue than perhaps
the problem is that your data is not encoded in the character set you think
it is encoded in.


>
>
> I shall try to use the admin interface instead, but today I can only
> add one item at the time. Do you know any example how to add several
> items at the same time?
>

If you've got a script that parses the Excel file I'm not sure why you have
a pasting via the shell part involved at all -- why not just change the
script to issue directly whatever commands you are pasting into the shell
instead?  Doing anything interactive, whether in the admin interface or
manage.py shell, is much more cumbersome than just having a script do the
bulk data importing.  You also then bypass any issues specific to the
Windows command prompt and its character set issues.  But if the root of the
problem is the source encoding for your data, then bypassing the shell isn't
going to help, so again more information about what exactly is going wrong
would help people help you.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Different ways of working against a SQLite3 dB

2009-02-16 Thread DaSa


Thx for your tips!

I tried to update my Python version but it did not work.

Today I have my data in an Excel document, and I have a script that
parse the excel document and creates sql-commands that I paste in the
SQL shell. But as you know I have the problem with swedish signs.

I shall try to use the admin interface instead, but today I can only
add one item at the time. Do you know any example how to add several
items at the same time?


Best regards
Daniel
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Different ways of working against a SQLite3 dB

2009-02-15 Thread Karen Tracey
On Sun, Feb 15, 2009 at 10:31 AM, DaSa  wrote:

>
> Thx! But I have the correct chcp coding. I can write swedish signs in
> the promt, it is when I try to add them in the SQLite3 dB it goes
> wrong.
>
> I believe it is the "python manage.py shell" that can't handle swedish
> signs. If I insert an object containing swedish signs from the admin
> site and read it out in the "manage.py shell" I get weir signs.
>

That sounds like you may be hitting this Python issue:

http://bugs.python.org/issue1288615

If you are hitting that, it was fixed in Python 2.6 so you could try
upgrading.  Alternatively you could just patch whatever version of Python
you are running, it's a pretty simple fix:

http://svn.python.org/view/python/trunk/Lib/code.py?rev=65578=diff=65578=65577=python/trunk/Lib/code.py=/python/trunk/Lib/code.py


> Are there any other APIs I can use against the database?
>

Sure, just write a python script to do whatever you are planning on doing in
the interactive shell?  (It isn't entirely clear to me how using manage.py
shell is that much better than the admin interface for bulk data importing
-- I'd expect a script would be much better.  But maybe you are just trying
it out in the shell and concluding the script won't work because the shell
is not working.  If so, and if it is that Python issue, the script won't be
subject to the same problem so will likely work.)

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Different ways of working against a SQLite3 dB

2009-02-15 Thread DaSa

Thx! But I have the correct chcp coding. I can write swedish signs in
the promt, it is when I try to add them in the SQLite3 dB it goes
wrong.

I believe it is the "python manage.py shell" that can't handle swedish
signs. If I insert an object containing swedish signs from the admin
site and read it out in the "manage.py shell" I get weir signs.

Are there any other APIs I can use against the database?


Best regards
Daniel

On Feb 15, 2:00 pm, Daniel Roseman 
wrote:
> On Feb 15, 12:53 pm, DaSa  wrote:
>
>
>
> > Hi,
>
> > Maybe this is a SQLite question, but a guess many Django users uses
> > SQLite3.
>
> > I have a lot of data that I want to export to my SQLite3 database. My
> > problem is that the data contains special signs (swedish åäö) and
> > therefore is it not possible to insert the data through "windows
> > command prompt" (and SQLite3 shell) because the windows command prompt
> > does not support swedish signs.
>
> > It works when I,am adding the data through my admin site (Django
> > default admin site), but because of the amount of data it is not
> > possible to add the item one and one.
>
> > My question are if there are any more ways of inserting the data into
> > the SQLite3 dB? Is it possible to open the SQLite3 shell without CMD?
>
> > Thx!
>
> > Best regards
> > Daniel Sandberg
>
> I don't know the answer - or anything about sqlite3 on Windows - but
> it is possible to change the character encoding on the Windows command
> shell. See the 'chcp' command, you should be able to find the correct
> one to allow you to use Swedish characters.
> --
> DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Different ways of working against a SQLite3 dB

2009-02-15 Thread Daniel Roseman

On Feb 15, 12:53 pm, DaSa  wrote:
> Hi,
>
> Maybe this is a SQLite question, but a guess many Django users uses
> SQLite3.
>
> I have a lot of data that I want to export to my SQLite3 database. My
> problem is that the data contains special signs (swedish åäö) and
> therefore is it not possible to insert the data through "windows
> command prompt" (and SQLite3 shell) because the windows command prompt
> does not support swedish signs.
>
> It works when I,am adding the data through my admin site (Django
> default admin site), but because of the amount of data it is not
> possible to add the item one and one.
>
> My question are if there are any more ways of inserting the data into
> the SQLite3 dB? Is it possible to open the SQLite3 shell without CMD?
>
> Thx!
>
> Best regards
> Daniel Sandberg

I don't know the answer - or anything about sqlite3 on Windows - but
it is possible to change the character encoding on the Windows command
shell. See the 'chcp' command, you should be able to find the correct
one to allow you to use Swedish characters.
--
DR.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---