Re: Erro em uma consulta Sqlite3

2022-08-04 Thread Alvaro Teixeira Silva
Bom dia meu amigo muito obrigado pela ajuda, foi um erro muito óbvio mas é
isso mesmo, valeu pela ajuda! comunidade foda!

Em qui., 4 de ago. de 2022 às 07:34, Joel Goldstick <
joel.goldst...@gmail.com> escreveu:

> On Thu, Aug 4, 2022 at 6:21 AM Luciano Martins  wrote:
> >
> > É  annotate
> > Publisher.objects.annotate(below_5=below_5).annotate(above_5=above_5)
> > Em quarta-feira, 3 de agosto de 2022 às 19:31:18 UTC-3,
> alvaroteixe...@gmail.com escreveu:
> >>
> >> Bom dia amigos, estou desenvolvendo um blog e me deparei com um erro em
> uma consulta, vou mandar o trecho do codigo onde esta o erro:
> >>
> >> def get_queryset(self):
> >> qs = super().get_queryset()
> >> qs = qs.order_by('-id')
> >> qs = qs.annotade(
> >> numero_comentarios=Count(
> >> Case(
> >> When(Comentario__publicado_comentario=True, then=1)
> >> )
> >> )
> >> )
> >>
> >> return qs
> >>
> >> Esse e o erro no terminal:
> >>
> >> AttributeError: 'QuerySet' object has no attribute 'annotade'
> >
> annotade is not the same as annotate
> > --
> > You received this message because you are subscribed to the Google
> Groups "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/bb9c8102-c7d8-4ec3-9fed-5e78aa84b13en%40googlegroups.com
> .
>
>
>
> --
> Joel Goldstick
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAPM-O%2ByXpNc5cB7VYQsTKPsN3RrUXHzzwhFoKBm9tJ2sRCDKBQ%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BMVKRq2CPr__adY11KH%2BX_zrN2Bxazzg%3Dywaw3BZqVigZwEjQ%40mail.gmail.com.


Re: Erro em uma consulta Sqlite3

2022-08-04 Thread Joel Goldstick
On Thu, Aug 4, 2022 at 6:21 AM Luciano Martins  wrote:
>
> É  annotate
> Publisher.objects.annotate(below_5=below_5).annotate(above_5=above_5)
> Em quarta-feira, 3 de agosto de 2022 às 19:31:18 UTC-3, 
> alvaroteixe...@gmail.com escreveu:
>>
>> Bom dia amigos, estou desenvolvendo um blog e me deparei com um erro em uma 
>> consulta, vou mandar o trecho do codigo onde esta o erro:
>>
>> def get_queryset(self):
>> qs = super().get_queryset()
>> qs = qs.order_by('-id')
>> qs = qs.annotade(
>> numero_comentarios=Count(
>> Case(
>> When(Comentario__publicado_comentario=True, then=1)
>> )
>> )
>> )
>>
>> return qs
>>
>> Esse e o erro no terminal:
>>
>> AttributeError: 'QuerySet' object has no attribute 'annotade'
>
annotade is not the same as annotate
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/bb9c8102-c7d8-4ec3-9fed-5e78aa84b13en%40googlegroups.com.



-- 
Joel Goldstick

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPM-O%2ByXpNc5cB7VYQsTKPsN3RrUXHzzwhFoKBm9tJ2sRCDKBQ%40mail.gmail.com.


Re: Erro em uma consulta Sqlite3

2022-08-04 Thread Luciano Martins
É  *annotate*
Publisher.objects.annotate(below_5=below_5).annotate(above_5=above_5)
Em quarta-feira, 3 de agosto de 2022 às 19:31:18 UTC-3, 
alvaroteixe...@gmail.com escreveu:

> Bom dia amigos, estou desenvolvendo um blog e me deparei com um erro em 
> uma consulta, vou mandar o trecho do codigo onde esta o erro:
>
> def get_queryset(self):
> qs = super().get_queryset()
> qs = qs.order_by('-id')
> qs = qs.annotade(
> numero_comentarios=Count(
> Case(
> When(Comentario__publicado_comentario=True, then=1)
> )
> )
> )
>
> return qs
>
> Esse e o erro no terminal:
>
> AttributeError: 'QuerySet' object has no attribute 'annotade'
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/bb9c8102-c7d8-4ec3-9fed-5e78aa84b13en%40googlegroups.com.


Erro em uma consulta Sqlite3

2022-08-03 Thread Alvaro Teixeira Silva
Bom dia amigos, estou desenvolvendo um blog e me deparei com um erro em uma 
consulta, vou mandar o trecho do codigo onde esta o erro:

def get_queryset(self):
qs = super().get_queryset()
qs = qs.order_by('-id')
qs = qs.annotade(
numero_comentarios=Count(
Case(
When(Comentario__publicado_comentario=True, then=1)
)
)
)

return qs

Esse e o erro no terminal:

AttributeError: 'QuerySet' object has no attribute 'annotade'

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/898a542b-72e5-41d2-8ce3-b12d704972cen%40googlegroups.com.


Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-07-08 Thread Joseph Borge
I tried to configure and compile with all 3 variables and that did work as 
expected.
Thanks!

# C_INCLUDE_PATH=/usr/local/include CPLUS_INCLUDE_PATH=/usr/local/include 
LD_RUN_PATH=/usr/local/lib ./configure --enable-optimizations

# C_INCLUDE_PATH=/usr/local/include CPLUS_INCLUDE_PATH=/usr/local/include 
LD_RUN_PATH=/usr/local/lib make

# C_INCLUDE_PATH=/usr/local/include CPLUS_INCLUDE_PATH=/usr/local/include 
LD_RUN_PATH=/usr/local/lib make install
On Wednesday, January 20, 2021 at 7:09:42 PM UTC-8 panfei wrote:

> It finally proved a compilation issue, this is the right way to compile 
> Python 3.9:
>
> 1033 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations 
> 1034 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make 
> 1035 make clean 
> 1036 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations 
> 1037 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make 
> 1038 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/ 
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make install 
> 1039 /home/felix/.local/python/python-3.9.1/bin/python3 
> 1040 history 
> [felix@localhost Python-3.9.1]$ 
> /home/felix/.local/python/python-3.9.1/bin/python3 
> Python 3.9.1 (default, Jan 21 2021, 10:58:50) 
> [GCC 10.2.0] on linux 
> Type "help", "copyright", "credits" or "license" for more information. 
> >>> import sqlite3 
> >>> conn = sqlite3.connect(':memory:') 
> >>> conn.create_function('f', 2, lambda *args: None, deterministic=True) 
> >>>
>
> Every step should specify the same environment variables.
>
> 'Amitesh Sahay' via Django users  
> 于2021年1月20日周三 下午10:06写道:
>
>> Please read the release notes of the Django version you are using. It 
>> will be a life saver as well.
>>
>> Regards,
>> Amitesh 
>>
>>
>> On Wednesday, 20 January, 2021, 07:35:14 pm IST, Amitesh Sahay <
>> amites...@yahoo.com> wrote: 
>>
>>
>> So, this seems to be a version compatibility issue, a a work around you 
>> can use some other database(mysql, oracle, etc). This cud save ur day and 
>> time as well.
>>
>> Regards,
>> Amitesh 
>>
>> On Wednesday, 20 January, 2021, 07:32:59 pm IST, panfei  
>> wrote: 
>>
>>
>> I have tried, it works in Python 3.6 environment. but I still want to 
>> find a way (maybe a workaround) to solve this problem.
>>
>> 'Amitesh Sahay' via Django users  
>> 于2021年1月20日周三 下午9:48写道:
>>
>> Try older version of Python interpreter and see if that works. May be  
>> consider using 3.6
>>
>> Regards,
>> Amitesh 
>>
>>
>> On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei  
>> wrote: 
>>
>>
>> I found that, it may not be a Django-related issue, It's more likely a 
>> Python level issue, but do anyone know how to avoid this problem?:
>>
>> (venv) [felix@localhost blueprint]$ python
>> Python 3.9.1 (default, Jan 20 2021, 14:32:50) 
>> [GCC 10.2.0] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import sqlite3
>> >>> conn = sqlite3.connect(':memory:')
>> >>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
>> Traceback (most recent call last):
>>   File "", line 1, in 
>> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or 
>> higher
>> >>> sqlite3.sqlite_version
>> '3.34.0'
>> >>> sqlite3.version
>> '2.6.0'
>> >>> 
>>
>>
>> panfei  于2021年1月20日周三 下午8:03写道:
>>
>>
>> System environment:
>>
>> Cent OS 7
>> Sqlite3 3.34.0 (Compile from source)
>> Python 3.9.1 (Compile from source)
>> Django 3.1.5 (Pip install)
>>
>>

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
It finally proved a compilation issue, this is the right way to compile
Python 3.9:

1033 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
1034 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make
1035 make clean
1036 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
1037 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make
1038 C_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/default/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib make install
1039 /home/felix/.local/python/python-3.9.1/bin/python3
1040 history
[felix@localhost Python-3.9.1]$
/home/felix/.local/python/python-3.9.1/bin/python3
Python 3.9.1 (default, Jan 21 2021, 10:58:50)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
>>>

Every step should specify the same environment variables.

'Amitesh Sahay' via Django users 
于2021年1月20日周三 下午10:06写道:

> Please read the release notes of the Django version you are using. It will
> be a life saver as well.
>
> Regards,
> Amitesh
>
>
> On Wednesday, 20 January, 2021, 07:35:14 pm IST, Amitesh Sahay <
> amitesh.sa...@yahoo.com> wrote:
>
>
> So, this seems to be a version compatibility issue, a a work around you
> can use some other database(mysql, oracle, etc). This cud save ur day and
> time as well.
>
> Regards,
> Amitesh
>
> On Wednesday, 20 January, 2021, 07:32:59 pm IST, panfei 
> wrote:
>
>
> I have tried, it works in Python 3.6 environment. but I still want to find
> a way (maybe a workaround) to solve this problem.
>
> 'Amitesh Sahay' via Django users 
> 于2021年1月20日周三 下午9:48写道:
>
> Try older version of Python interpreter and see if that works. May be
> consider using 3.6
>
> Regards,
> Amitesh
>
>
> On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei 
> wrote:
>
>
> I found that, it may not be a Django-related issue, It's more likely a
> Python level issue, but do anyone know how to avoid this problem?:
>
> (venv) [felix@localhost blueprint]$ python
> Python 3.9.1 (default, Jan 20 2021, 14:32:50)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sqlite3
> >>> conn = sqlite3.connect(':memory:')
> >>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
> Traceback (most recent call last):
>   File "", line 1, in 
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
> higher
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
>
> panfei  于2021年1月20日周三 下午8:03写道:
>
>
> System environment:
>
> Cent OS 7
> Sqlite3 3.34.0 (Compile from source)
> Python 3.9.1 (Compile from source)
> Django 3.1.5 (Pip install)
>
>
> 1. Compile sqlite3:
> ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
> make && make install
>
> 2. Add sqlite3 lib to lib search path:
>
> export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
> export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
>
> 3. Compile Python 3.9.1
> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> make && make install
>
> 4. Create a venv and install django and start a demo project
> cd /tmp
> /home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
> source venv/bin/activate
> pip install django
> djagno-admin startproject demo
> cd demo
>
> 4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
> (venv) [felix@localhost blueprin

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
Thanks for all the suggestions.

'Amitesh Sahay' via Django users 
于2021年1月20日周三 下午10:06写道:

> Please read the release notes of the Django version you are using. It will
> be a life saver as well.
>
> Regards,
> Amitesh
>
>
> On Wednesday, 20 January, 2021, 07:35:14 pm IST, Amitesh Sahay <
> amitesh.sa...@yahoo.com> wrote:
>
>
> So, this seems to be a version compatibility issue, a a work around you
> can use some other database(mysql, oracle, etc). This cud save ur day and
> time as well.
>
> Regards,
> Amitesh
>
> On Wednesday, 20 January, 2021, 07:32:59 pm IST, panfei 
> wrote:
>
>
> I have tried, it works in Python 3.6 environment. but I still want to find
> a way (maybe a workaround) to solve this problem.
>
> 'Amitesh Sahay' via Django users 
> 于2021年1月20日周三 下午9:48写道:
>
> Try older version of Python interpreter and see if that works. May be
> consider using 3.6
>
> Regards,
> Amitesh
>
>
> On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei 
> wrote:
>
>
> I found that, it may not be a Django-related issue, It's more likely a
> Python level issue, but do anyone know how to avoid this problem?:
>
> (venv) [felix@localhost blueprint]$ python
> Python 3.9.1 (default, Jan 20 2021, 14:32:50)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sqlite3
> >>> conn = sqlite3.connect(':memory:')
> >>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
> Traceback (most recent call last):
>   File "", line 1, in 
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
> higher
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
>
> panfei  于2021年1月20日周三 下午8:03写道:
>
>
> System environment:
>
> Cent OS 7
> Sqlite3 3.34.0 (Compile from source)
> Python 3.9.1 (Compile from source)
> Django 3.1.5 (Pip install)
>
>
> 1. Compile sqlite3:
> ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
> make && make install
>
> 2. Add sqlite3 lib to lib search path:
>
> export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
> export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
>
> 3. Compile Python 3.9.1
> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> make && make install
>
> 4. Create a venv and install django and start a demo project
> cd /tmp
> /home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
> source venv/bin/activate
> pip install django
> djagno-admin startproject demo
> cd demo
>
> 4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
> (venv) [felix@localhost blueprint]$ python manage.py shell
> Python 3.9.0 (default, Jan 20 2021, 12:53:25)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> import sqlite3
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
> 5. Run the demo project (cannot find the new sqlite version ? strange.):
> (venv) [felix@localhost blueprint]$ python manage.py runserver
> Watching for file changes with StatReloader
> Performing system checks...
>
> System check identified no issues (0 silenced).
> Exception in thread django-main-thread:
> Traceback (most recent call last):
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 219, in ensure_connection
> self.connect()
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 200, in connect
> self.connection = self.get_new_connection(conn_params)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py"

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread 'Amitesh Sahay' via Django users
Please read the release notes of the Django version you are using. It will be a 
life saver as well.


Regards,
Amitesh  

On Wednesday, 20 January, 2021, 07:35:14 pm IST, Amitesh Sahay 
 wrote:  
 
 So, this seems to be a version compatibility issue, a a work around you can 
use some other database(mysql, oracle, etc). This cud save ur day and time as 
well.


Regards,
Amitesh 
On Wednesday, 20 January, 2021, 07:32:59 pm IST, panfei  
wrote:  
 
 I have tried, it works in Python 3.6 environment. but I still want to find a 
way (maybe a workaround) to solve this problem.

'Amitesh Sahay' via Django users  于2021年1月20日周三 
下午9:48写道:

Try older version of Python interpreter and see if that works. May be  consider 
using 3.6


Regards,
Amitesh  

On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei  
wrote:  
 
 I found that, it may not be a Django-related issue, It's more likely a Python 
level issue, but do anyone know how to avoid this problem?:
(venv) [felix@localhost blueprint]$ python
Python 3.9.1 (default, Jan 20 2021, 14:32:50) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
Traceback (most recent call last):
  File "", line 1, in 
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 


panfei  于2021年1月20日周三 下午8:03写道:


System environment:
Cent OS 7
Sqlite3 3.34.0 (Compile from source)Python 3.9.1 (Compile from source)
Django 3.1.5 (Pip install)


1. Compile sqlite3:./configure 
--prefix=/home/felix/.local/sqlite/sqlite-3.34.0make && make install
2. Add sqlite3 lib to lib search path:
export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/libexport 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
3. Compile Python 
3.9.1C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizationsmake && 
make install
4. Create a venv and install django and start a demo projectcd /tmp
/home/felix/.local/python/python-3.9.1/bin/python3 -m venv venvsource 
venv/bin/activatepip install djangodjagno-admin startproject democd demo
4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
(venv) [felix@localhost blueprint]$ python manage.py shell
Python 3.9.0 (default, Jan 20 2021, 12:53:25) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 

5. Run the demo project (cannot find the new sqlite version ? strange.):(venv) 
[felix@localhost blueprint]$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 219, in ensure_connection
    self.connect()
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
 line 215, in get_new_connection
    create_deterministic_function('django_date_extract', 2, 
_sqlite_datetime_extract)
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 950, in _bootstrap_inner
    self.run()
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 888, in run
    self._target(*self._args, **self._kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
 line 

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread 'Amitesh Sahay' via Django users
So, this seems to be a version compatibility issue, a a work around you can use 
some other database(mysql, oracle, etc). This cud save ur day and time as well.


Regards,
Amitesh 
On Wednesday, 20 January, 2021, 07:32:59 pm IST, panfei  
wrote:  
 
 I have tried, it works in Python 3.6 environment. but I still want to find a 
way (maybe a workaround) to solve this problem.

'Amitesh Sahay' via Django users  于2021年1月20日周三 
下午9:48写道:

Try older version of Python interpreter and see if that works. May be  consider 
using 3.6


Regards,
Amitesh  

On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei  
wrote:  
 
 I found that, it may not be a Django-related issue, It's more likely a Python 
level issue, but do anyone know how to avoid this problem?:
(venv) [felix@localhost blueprint]$ python
Python 3.9.1 (default, Jan 20 2021, 14:32:50) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
Traceback (most recent call last):
  File "", line 1, in 
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 


panfei  于2021年1月20日周三 下午8:03写道:


System environment:
Cent OS 7
Sqlite3 3.34.0 (Compile from source)Python 3.9.1 (Compile from source)
Django 3.1.5 (Pip install)


1. Compile sqlite3:./configure 
--prefix=/home/felix/.local/sqlite/sqlite-3.34.0make && make install
2. Add sqlite3 lib to lib search path:
export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/libexport 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
3. Compile Python 
3.9.1C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizationsmake && 
make install
4. Create a venv and install django and start a demo projectcd /tmp
/home/felix/.local/python/python-3.9.1/bin/python3 -m venv venvsource 
venv/bin/activatepip install djangodjagno-admin startproject democd demo
4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
(venv) [felix@localhost blueprint]$ python manage.py shell
Python 3.9.0 (default, Jan 20 2021, 12:53:25) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 

5. Run the demo project (cannot find the new sqlite version ? strange.):(venv) 
[felix@localhost blueprint]$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 219, in ensure_connection
    self.connect()
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
 line 215, in get_new_connection
    create_deterministic_function('django_date_extract', 2, 
_sqlite_datetime_extract)
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 950, in _bootstrap_inner
    self.run()
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 888, in run
    self._target(*self._args, **self._kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
 line 53, in wrapper
    fn(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/commands/runserver.py",
 line 121, in inner_run
 

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
The exception is raised from inside the C implementation in Python when
checking sqlite3 version check.
In Django:

@async_unsafe
def get_new_connection(self, conn_params):
conn = Database.connect(**conn_params)
if PY38:
create_deterministic_function = functools.partial(
conn.create_function,
deterministic=True,
)
else:
create_deterministic_function = conn.create_function

if PY38 (means python version greater or equal to 3.8) is True, the new
created function will call conn.create_function with deterministic=True, so
the exception happens.

panfei  于2021年1月20日周三 下午9:54写道:

> I have tried, it works in Python 3.6 environment. but I still want to find
> a way (maybe a workaround) to solve this problem.
>
> 'Amitesh Sahay' via Django users 
> 于2021年1月20日周三 下午9:48写道:
>
>> Try older version of Python interpreter and see if that works. May be
>> consider using 3.6
>>
>> Regards,
>> Amitesh
>>
>>
>> On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei <
>> cnwe...@gmail.com> wrote:
>>
>>
>> I found that, it may not be a Django-related issue, It's more likely a
>> Python level issue, but do anyone know how to avoid this problem?:
>>
>> (venv) [felix@localhost blueprint]$ python
>> Python 3.9.1 (default, Jan 20 2021, 14:32:50)
>> [GCC 10.2.0] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> import sqlite3
>> >>> conn = sqlite3.connect(':memory:')
>> >>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
>> Traceback (most recent call last):
>>   File "", line 1, in 
>> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
>> higher
>> >>> sqlite3.sqlite_version
>> '3.34.0'
>> >>> sqlite3.version
>> '2.6.0'
>> >>>
>>
>>
>> panfei  于2021年1月20日周三 下午8:03写道:
>>
>>
>> System environment:
>>
>> Cent OS 7
>> Sqlite3 3.34.0 (Compile from source)
>> Python 3.9.1 (Compile from source)
>> Django 3.1.5 (Pip install)
>>
>>
>> 1. Compile sqlite3:
>> ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
>> make && make install
>>
>> 2. Add sqlite3 lib to lib search path:
>>
>> export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
>> export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
>>
>> 3. Compile Python 3.9.1
>> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
>> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
>> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
>> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
>> make && make install
>>
>> 4. Create a venv and install django and start a demo project
>> cd /tmp
>> /home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
>> source venv/bin/activate
>> pip install django
>> djagno-admin startproject demo
>> cd demo
>>
>> 4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
>> (venv) [felix@localhost blueprint]$ python manage.py shell
>> Python 3.9.0 (default, Jan 20 2021, 12:53:25)
>> [GCC 10.2.0] on linux
>> Type "help", "copyright", "credits" or "license" for more information.
>> (InteractiveConsole)
>> >>> import sqlite3
>> >>> sqlite3.sqlite_version
>> '3.34.0'
>> >>> sqlite3.version
>> '2.6.0'
>> >>>
>>
>> 5. Run the demo project (cannot find the new sqlite version ? strange.):
>> (venv) [felix@localhost blueprint]$ python manage.py runserver
>> Watching for file changes with StatReloader
>> Performing system checks...
>>
>> System check identified no issues (0 silenced).
>> Exception in thread django-main-thread:
>> Traceback (most recent call last):
>>   File
>> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
>> line 219, in ensure_connection
>> self.connect()
>>   File
>> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
>> line 26, in inner
>> return func(*args, **kwargs)
>>   File
>> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
>> line 200, in co

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
I have tried, it works in Python 3.6 environment. but I still want to find
a way (maybe a workaround) to solve this problem.

'Amitesh Sahay' via Django users 
于2021年1月20日周三 下午9:48写道:

> Try older version of Python interpreter and see if that works. May be
> consider using 3.6
>
> Regards,
> Amitesh
>
>
> On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei 
> wrote:
>
>
> I found that, it may not be a Django-related issue, It's more likely a
> Python level issue, but do anyone know how to avoid this problem?:
>
> (venv) [felix@localhost blueprint]$ python
> Python 3.9.1 (default, Jan 20 2021, 14:32:50)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sqlite3
> >>> conn = sqlite3.connect(':memory:')
> >>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
> Traceback (most recent call last):
>   File "", line 1, in 
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
> higher
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
>
> panfei  于2021年1月20日周三 下午8:03写道:
>
>
> System environment:
>
> Cent OS 7
> Sqlite3 3.34.0 (Compile from source)
> Python 3.9.1 (Compile from source)
> Django 3.1.5 (Pip install)
>
>
> 1. Compile sqlite3:
> ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
> make && make install
>
> 2. Add sqlite3 lib to lib search path:
>
> export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
> export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
>
> 3. Compile Python 3.9.1
> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> make && make install
>
> 4. Create a venv and install django and start a demo project
> cd /tmp
> /home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
> source venv/bin/activate
> pip install django
> djagno-admin startproject demo
> cd demo
>
> 4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
> (venv) [felix@localhost blueprint]$ python manage.py shell
> Python 3.9.0 (default, Jan 20 2021, 12:53:25)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> import sqlite3
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
> 5. Run the demo project (cannot find the new sqlite version ? strange.):
> (venv) [felix@localhost blueprint]$ python manage.py runserver
> Watching for file changes with StatReloader
> Performing system checks...
>
> System check identified no issues (0 silenced).
> Exception in thread django-main-thread:
> Traceback (most recent call last):
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 219, in ensure_connection
> self.connect()
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 200, in connect
> self.connection = self.get_new_connection(conn_params)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
> line 215, in get_new_connection
> create_deterministic_function('django_date_extract', 2,
> _sqlite_datetime_extract)
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
> higher
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File
> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
> 950, in _bootstrap_inner
> self.run()
>   File
> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
> 888, in run
> self._target(*self._args, **self._kwargs)
>   File
>

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread 'Amitesh Sahay' via Django users
Try older version of Python interpreter and see if that works. May be  consider 
using 3.6


Regards,
Amitesh  

On Wednesday, 20 January, 2021, 05:55:32 pm IST, panfei  
wrote:  
 
 I found that, it may not be a Django-related issue, It's more likely a Python 
level issue, but do anyone know how to avoid this problem?:
(venv) [felix@localhost blueprint]$ python
Python 3.9.1 (default, Jan 20 2021, 14:32:50) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
Traceback (most recent call last):
  File "", line 1, in 
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 


panfei  于2021年1月20日周三 下午8:03写道:


System environment:
Cent OS 7
Sqlite3 3.34.0 (Compile from source)Python 3.9.1 (Compile from source)
Django 3.1.5 (Pip install)


1. Compile sqlite3:./configure 
--prefix=/home/felix/.local/sqlite/sqlite-3.34.0make && make install
2. Add sqlite3 lib to lib search path:
export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/libexport 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
3. Compile Python 
3.9.1C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/ 
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure 
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizationsmake && 
make install
4. Create a venv and install django and start a demo projectcd /tmp
/home/felix/.local/python/python-3.9.1/bin/python3 -m venv venvsource 
venv/bin/activatepip install djangodjagno-admin startproject democd demo
4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
(venv) [felix@localhost blueprint]$ python manage.py shell
Python 3.9.0 (default, Jan 20 2021, 12:53:25) 
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>> 

5. Run the demo project (cannot find the new sqlite version ? strange.):(venv) 
[felix@localhost blueprint]$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 219, in ensure_connection
    self.connect()
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
 line 200, in connect
    self.connection = self.get_new_connection(conn_params)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
 line 26, in inner
    return func(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
 line 215, in get_new_connection
    create_deterministic_function('django_date_extract', 2, 
_sqlite_datetime_extract)
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or higher

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 950, in _bootstrap_inner
    self.run()
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", 
line 888, in run
    self._target(*self._args, **self._kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
 line 53, in wrapper
    fn(*args, **kwargs)
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/commands/runserver.py",
 line 121, in inner_run
    self.check_migrations()
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/base.py",
 line 459, in check_migrations
    executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File 
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/executor.py",
 line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File 
"/home/fe

Re: python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
I found that, it may not be a Django-related issue, It's more likely a
Python level issue, but do anyone know how to avoid this problem?:

(venv) [felix@localhost blueprint]$ python
Python 3.9.1 (default, Jan 20 2021, 14:32:50)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> conn = sqlite3.connect(':memory:')
>>> conn.create_function('f', 2, lambda *args: None, deterministic=True)
Traceback (most recent call last):
  File "", line 1, in 
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
higher
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>>


panfei  于2021年1月20日周三 下午8:03写道:

>
> System environment:
>
> Cent OS 7
> Sqlite3 3.34.0 (Compile from source)
> Python 3.9.1 (Compile from source)
> Django 3.1.5 (Pip install)
>
>
> 1. Compile sqlite3:
> ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
> make && make install
>
> 2. Add sqlite3 lib to lib search path:
>
> export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
> export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib
>
> 3. Compile Python 3.9.1
> C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
> LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
> --prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
> make && make install
>
> 4. Create a venv and install django and start a demo project
> cd /tmp
> /home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
> source venv/bin/activate
> pip install django
> djagno-admin startproject demo
> cd demo
>
> 4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
> (venv) [felix@localhost blueprint]$ python manage.py shell
> Python 3.9.0 (default, Jan 20 2021, 12:53:25)
> [GCC 10.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> import sqlite3
> >>> sqlite3.sqlite_version
> '3.34.0'
> >>> sqlite3.version
> '2.6.0'
> >>>
>
> 5. Run the demo project (cannot find the new sqlite version ? strange.):
> (venv) [felix@localhost blueprint]$ python manage.py runserver
> Watching for file changes with StatReloader
> Performing system checks...
>
> System check identified no issues (0 silenced).
> Exception in thread django-main-thread:
> Traceback (most recent call last):
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 219, in ensure_connection
> self.connect()
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
> line 200, in connect
> self.connection = self.get_new_connection(conn_params)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
> line 26, in inner
> return func(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
> line 215, in get_new_connection
> create_deterministic_function('django_date_extract', 2,
> _sqlite_datetime_extract)
> sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
> higher
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File
> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
> 950, in _bootstrap_inner
> self.run()
>   File
> "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py", line
> 888, in run
> self._target(*self._args, **self._kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
> line 53, in wrapper
> fn(*args, **kwargs)
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/commands/runserver.py",
> line 121, in inner_run
> self.check_migrations()
>   File
> "/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/base.py",
> line 459, in check_migratio

python manage.py runserver can not use newly compiled sqlite3 lib on CentOS 7

2021-01-20 Thread panfei
System environment:

Cent OS 7
Sqlite3 3.34.0 (Compile from source)
Python 3.9.1 (Compile from source)
Django 3.1.5 (Pip install)


1. Compile sqlite3:
./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0
make && make install

2. Add sqlite3 lib to lib search path:

export LD_LIBRARY_PATH=/home/felix/.local/sqlite/default/lib
export LD_RUN_PATH=/home/felix/.local/sqlite/default/lib

3. Compile Python 3.9.1
C_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
CPLUS_INCLUDE_PATH=/home/felix/.local/sqlite/sqlite-3.34.0/include/
LD_RUN_PATH=/home/felix/.local/sqlite/default/lib ./configure
--prefix=/home/felix/.local/python/python-3.9.1 --enable-optimizations
make && make install

4. Create a venv and install django and start a demo project
cd /tmp
/home/felix/.local/python/python-3.9.1/bin/python3 -m venv venv
source venv/bin/activate
pip install django
djagno-admin startproject demo
cd demo

4 Check sqlite3 lib version (seems to be OK, sqlite_version is 3.34.0)
(venv) [felix@localhost blueprint]$ python manage.py shell
Python 3.9.0 (default, Jan 20 2021, 12:53:25)
[GCC 10.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import sqlite3
>>> sqlite3.sqlite_version
'3.34.0'
>>> sqlite3.version
'2.6.0'
>>>

5. Run the demo project (cannot find the new sqlite version ? strange.):
(venv) [felix@localhost blueprint]$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
Exception in thread django-main-thread:
Traceback (most recent call last):
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
line 219, in ensure_connection
self.connect()
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
line 26, in inner
return func(*args, **kwargs)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
line 200, in connect
self.connection = self.get_new_connection(conn_params)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
line 26, in inner
return func(*args, **kwargs)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py",
line 215, in get_new_connection
create_deterministic_function('django_date_extract', 2,
_sqlite_datetime_extract)
sqlite3.NotSupportedError: deterministic=True requires SQLite 3.8.3 or
higher

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py",
line 950, in _bootstrap_inner
self.run()
  File "/home/felix/.local/python/python-3.9.0/lib/python3.9/threading.py",
line 888, in run
self._target(*self._args, **self._kwargs)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/autoreload.py",
line 53, in wrapper
fn(*args, **kwargs)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/commands/runserver.py",
line 121, in inner_run
self.check_migrations()
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/core/management/base.py",
line 459, in check_migrations
executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/executor.py",
line 18, in __init__
self.loader = MigrationLoader(self.connection)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/loader.py",
line 53, in __init__
self.build_graph()
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/loader.py",
line 216, in build_graph
self.applied_migrations = recorder.applied_migrations()
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/recorder.py",
line 77, in applied_migrations
if self.has_table():
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/migrations/recorder.py",
line 55, in has_table
with self.connection.cursor() as cursor:
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/utils/asyncio.py",
line 26, in inner
return func(*args, **kwargs)
  File
"/home/felix/PycharmProjects/blueprint/venv/lib/python3.9/site-packages/django/db/backends/base/base.py",
line 259, in cursor
return se

Re: Reg:Electron and sqlite3 packaging issue

2020-10-11 Thread Dvs Khamele
Hi do you hire contract based python/django freelancer?
We can help you in this and related techincal tasks at fair prices. Reply
or send email to divy...@pythonmate.com
Best Regards,
Divyesh Khamele,
Pythonmate

On Tue, 29 Sep 2020, 7:12 pm Divakar Upadhyay, <
upadhyaydivakar1...@gmail.com> wrote:

> Dear Friends,
> I am working on electron js and sqlite3. As my app is working fine in
> development mode but it is giving issue after packaging and running my
> exe.you can find issue in my attachment.If any one have any clue please let
> me know.
> I will be great thankful to you.
>
>
> Divakar Rakesh Upadhyay
> Software Engineer
> 9372129286
> skype:upadhyaydivakar1991
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAG5yzPAwjud-_Q-5L%2B-yHVFr%3Dm930ZKwhLH27BdAquSNqQLV9A%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAG5yzPAwjud-_Q-5L%2B-yHVFr%3Dm930ZKwhLH27BdAquSNqQLV9A%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAH9mneWUge2czw1BQ66F%2BwTzzHOvF%3DiYRpdkvSs51cnTWE49-A%40mail.gmail.com.


Re: Django shared-cache for in-memory SQLite3 is not working

2020-09-25 Thread Krishna Chaitanya
On Sat, Sep 26, 2020 at 1:20 AM Krishna Chaitanya
 wrote:
>
> Hi,
>
> I am using Django 1.11 (default on 18.04). But I am still seeing
> https://code.djangoproject.com/ticket/12118 which is fixed in 1.8.
>
> models.save() in a thread is not being committed and not reflected in the
> main thread. I am using py3.6 and sqlite3 version is also met.
>
> $ python3 -c "from sqlite3 import dbapi2 as Database; print
> (Database.__name__, Database.sqlite_version__info)"
>
> sqlite3.dbapi2 (3, 22, 0)
>
> Am I missing something? Any help is appreciated.
>
> Cheers.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABPxzYL_uHDjtxrxtF%3DmH4TscXHU-ZU4iR4Kzz98jicf1y9thQ%40mail.gmail.com.


Re: Sqlite3 error

2020-04-29 Thread Kasper Laudrup

Hi Chucks,

On 28/04/2020 19.17, chucks ogwo wrote:


I also tried to use pip to install sqlite3, it does not work too, I get 
a different error.



(venv) C:\Users\Dell\PycharmProjects\interact_with_database>pip install 
sqlite3

Collecting sqlite3
   Could not find a version that satisfies the requirement sqlite3 (from 
versions: )

No matching distribution found for sqlite3

(venv) C:\Users\Dell\PycharmProjects\interact_with_database>


Does anyone know how I can solve this problem?



https://stackoverflow.com/questions/19530974/how-can-i-add-the-sqlite3-module-to-python

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/87af72df-df66-ecc0-265c-1b28413da754%40stacktrace.dk.


Re: Sqlite3 error

2020-04-28 Thread LGBS fine soul coders
Well try to download sqlite from google then install to your mashine
manually dont use pip

On Tue, 28 Apr 2020, 20:17 chucks ogwo,  wrote:

> Hi, Everyone, I have been trying to interact with the sqlite3 database on
> Pycharm, every time I run the code it gives me an import error.
>
>
> Traceback (most recent call last):
>   File ".\file.py", line 1, in 
> import sqlite3
>   File "C:\Users\Dell\anaconda3\lib\sqlite3\__init__.py", line 23, in
> 
> from sqlite3.dbapi2 import *
>   File "C:\Users\Dell\anaconda3\lib\sqlite3\dbapi2.py", line 27, in
> 
> from _sqlite3 import *
> ImportError: DLL load failed: The specified module could not be found.
>
> (venv) C:\Users\Dell\PycharmProjects\interact_with_database>
>
>
> I also tried to use pip to install sqlite3, it does not work too, I get a
> different error.
>
>
> (venv) C:\Users\Dell\PycharmProjects\interact_with_database>pip install
> sqlite3
> Collecting sqlite3
>   Could not find a version that satisfies the requirement sqlite3 (from
> versions: )
> No matching distribution found for sqlite3
>
> (venv) C:\Users\Dell\PycharmProjects\interact_with_database>
>
>
> Does anyone know how I can solve this problem?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d3220c84-cfa9-4bd7-9890-3cdbf9a5493f%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/d3220c84-cfa9-4bd7-9890-3cdbf9a5493f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKNQJk5%2BbvG%3DSq2ZSk6Yzutyfn89BzjPrxNXzZShZEwMeU%2B9og%40mail.gmail.com.


Sqlite3 error

2020-04-28 Thread chucks ogwo
Hi, Everyone, I have been trying to interact with the sqlite3 database on 
Pycharm, every time I run the code it gives me an import error. 


Traceback (most recent call last):
  File ".\file.py", line 1, in 
    import sqlite3
  File "C:\Users\Dell\anaconda3\lib\sqlite3\__init__.py", line 23, in 

from sqlite3.dbapi2 import *
  File "C:\Users\Dell\anaconda3\lib\sqlite3\dbapi2.py", line 27, in 
from _sqlite3 import *
ImportError: DLL load failed: The specified module could not be found.

(venv) C:\Users\Dell\PycharmProjects\interact_with_database>


I also tried to use pip to install sqlite3, it does not work too, I get a 
different error. 


(venv) C:\Users\Dell\PycharmProjects\interact_with_database>pip install 
sqlite3
Collecting sqlite3
  Could not find a version that satisfies the requirement sqlite3 (from 
versions: )
No matching distribution found for sqlite3

(venv) C:\Users\Dell\PycharmProjects\interact_with_database>


Does anyone know how I can solve this problem?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d3220c84-cfa9-4bd7-9890-3cdbf9a5493f%40googlegroups.com.


Re: I have issue. I want to migrate database from sqlite3 to postgresql. With a table have 10M records. I need a solution for issue. Maybe help me?

2020-03-26 Thread Farai M
Export to csv  in SQL then import into postgresql from there

On Wed, Mar 25, 2020, 6:43 PM Thắng IT  wrote:

> solution
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/067ffc03-bb03-4a52-8921-21e818a5b41f%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMeub5Ot%3DgoqvfmxsbUP7gioRMWjQReSW4gNtG-PkPnHPvaPYA%40mail.gmail.com.


Re: I have issue. I want to migrate database from sqlite3 to postgresql. With a table have 10M records. I need a solution for issue. Maybe help me?

2020-03-26 Thread Daniel Chimeno
One possible solution:

$ createdb newdb
$ pgloader ./test/sqlite/sqlite.db postgresql:///newdb

https://github.com/dimitri/pgloader



El miércoles, 25 de marzo de 2020, 17:45:54 (UTC+1), Thắng IT escribió:
>
> solution

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3435d5bf-0422-4be0-afd5-e61b13460ea1%40googlegroups.com.


Re: I have issue. I want to migrate database from sqlite3 to postgresql. With a table have 10M records. I need a solution for issue. Maybe help me?

2020-03-25 Thread Motaz Hejaze
cant be done directly from sqlite to postgres as there are differences
between them ...
safer to generate an intermediate file like a CSV or Excel file from the
sqlite database ..
create the new postgres database with proper column types ..
make a python script to loop through each row in CSV or Excel file and
populate each row in new postgres database

On Wed, Mar 25, 2020 at 6:43 PM Thắng IT  wrote:

> solution
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/067ffc03-bb03-4a52-8921-21e818a5b41f%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHV4E-fWUFVzsTC7VjWZoRq%2B_-NWyop1sa_RA%2BJuGia_mfP5GA%40mail.gmail.com.


I have issue. I want to migrate database from sqlite3 to postgresql. With a table have 10M records. I need a solution for issue. Maybe help me?

2020-03-25 Thread Thắng IT
solution

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/067ffc03-bb03-4a52-8921-21e818a5b41f%40googlegroups.com.


Recorrer una tabla sqlite3 en una view Django

2019-10-18 Thread Gabriel Araya Garcia
¿Como puedo recorrer registro a registro una tabla e ir insertando dicha 
informacion en otra tabla segun criterio de lo que tenga en un campo de la 
primera tabla?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/40adc444-46a4-4ad9-b3f5-f3cda65fae1d%40googlegroups.com.


Re: Can anyone share code for uploading csv or excel file to sqlite3 database.

2018-09-28 Thread PASCUAL Eric
Hi,


Which error(s) did you get exactly ? It is not clear in you message whether 
your problem is at the CSV data processing level or at the Django one.


In case this could help, using the standard csv module you can obtain a reader 
wich takes care of parsing and decoding thanks to the reader() module function. 
You pass it the file object directly, without reading its content in memory. 
Since it provides an iterator over the data, yielding rows one at a time as 
tuples, this lets you load big files without any problem.


The DictReader class of the same module works more or less the same way, but 
returns rows as dicts which keys are the CSV columns names, making the mapping 
code more readable and self-documented.


Best


Eric


From: django-users@googlegroups.com  on behalf 
of BBG 
Sent: Thursday, September 27, 2018 8:41:42 PM
To: Django users
Subject: Re: Can anyone share code for uploading csv or excel file to sqlite3 
database.

I have tried this but not working


def upload_csv(request):
data = {}
if "GET" == request.method:
return render(request, "add_student/bulk.html", data)
# if not GET, then proceed
try:
csv_file = request.FILES["csv_file"]
if not csv_file.name.endswith('.csv'):
messages.error(request,'File is not CSV type')
return HttpResponseRedirect(reverse("add_student:upload_csv"))
#if file is too large, return
if csv_file.multiple_chunks():
messages.error(request,"Uploaded file is too big (%.2f MB)." % 
(csv_file.size/(1000*1000),))
return HttpResponseRedirect(reverse("add_student:upload_csv"))

file_data = csv_file.read().decode("utf-8")

lines = file_data.split("\n")
#loop over the lines and save them in db. If error , store as string 
and then display
for line in lines:
fields = line.split(",")
data_dict = {}
data_dict["enrollment_no"] = fields[0]
data_dict["student_name"] = fields[1]
data_dict["gender"] = fields[2]
data_dict["course"] = fields[3]
data_dict["category"] = fields[4]
data_dict["admission_year"] = fields[5]
data_dict["branch"] = fields[6]
data_dict["current_semester"] = fields[7]
data_dict["address"] = fields[8]
data_dict["city"] = fields[9]
data_dict["district"] = fields[10]
data_dict["state"] = fields[11]
data_dict["student_contact"] = fields[12]
data_dict["parent_contact"] = fields[13]
try:
form = EventsForm(data_dict)
if form.is_valid():
form.save()
else:

logging.getLogger("error_logger").error(form.errors.as_json())
except Exception as e:
logging.getLogger("error_logger").error(repr(e))
pass
except Exception as e:
logging.getLogger("error_logger").error("Unable to upload file. 
"+repr(e))
messages.error(request,"Unable to upload file. "+repr(e))

return HttpResponseRedirect(reverse("add_student:upload_csv"))

On Thursday, September 27, 2018 at 1:59:24 PM UTC+5:30, Eric Pascual wrote:

Hi,


Have you studied the documentation of the CSV module included in Python 
standard library ?


You'll find there all the needed information for reading and interpreting CSV 
files without having to implement the raw parsing, and have there rows in a 
form ready to use for inserting objects in your model.


For performance's sake, it is advised to use bulk inserts or updates instead on 
individual saves on the Django side if your CSV files contain a lot of data.


Best


Eric


From: django...@googlegroups.com  on behalf of BBG 

Sent: Wednesday, September 26, 2018 6:04:09 PM
To: Django users
Subject: Can anyone share code for uploading csv or excel file to sqlite3 
database.

I want to create upload bulk data. Can anyone share code to upload csv or excel 
file.

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users...@googlegroups.com.
To post to this group, send email to djang...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fc5736a8-3396-491b-b265-853f46fdad87%40googlegroups.com<https://groups.google.com/d/msgid/django-users/fc57

Re: Can anyone share code for uploading csv or excel file to sqlite3 database.

2018-09-28 Thread Andréas Kühne
Is your template code correct? The form needs to have the following
property, otherwise uploading files won't work:
 enctype="multipart/form-data"

Regards,

Andréas


Den tors 27 sep. 2018 kl 20:42 skrev BBG :

> I have tried this but not working
>
> def upload_csv(request):
> data = {}
> if "GET" == request.method:
> return render(request, "add_student/bulk.html", data)
> # if not GET, then proceed
> try:
> csv_file = request.FILES["csv_file"]
> if not csv_file.name.endswith('.csv'):
> messages.error(request,'File is not CSV type')
> return HttpResponseRedirect(reverse("add_student:upload_csv"))
> #if file is too large, return
> if csv_file.multiple_chunks():
> messages.error(request,"Uploaded file is too big (%.2f MB)." % 
> (csv_file.size/(1000*1000),))
> return HttpResponseRedirect(reverse("add_student:upload_csv"))
>
> file_data = csv_file.read().decode("utf-8")
>
> lines = file_data.split("\n")
> #loop over the lines and save them in db. If error , store as string 
> and then display
> for line in lines:
> fields = line.split(",")
> data_dict = {}
> data_dict["enrollment_no"] = fields[0]
> data_dict["student_name"] = fields[1]
> data_dict["gender"] = fields[2]
> data_dict["course"] = fields[3]
> data_dict["category"] = fields[4]
> data_dict["admission_year"] = fields[5]
> data_dict["branch"] = fields[6]
> data_dict["current_semester"] = fields[7]
> data_dict["address"] = fields[8]
> data_dict["city"] = fields[9]
> data_dict["district"] = fields[10]
> data_dict["state"] = fields[11]
> data_dict["student_contact"] = fields[12]
> data_dict["parent_contact"] = fields[13]
> try:
> form = EventsForm(data_dict)
> if form.is_valid():
> form.save()
> else:
> 
> logging.getLogger("error_logger").error(form.errors.as_json())
> except Exception as e:
> logging.getLogger("error_logger").error(repr(e))
> pass
> except Exception as e:
> logging.getLogger("error_logger").error("Unable to upload file. 
> "+repr(e))
> messages.error(request,"Unable to upload file. "+repr(e))
>
> return HttpResponseRedirect(reverse("add_student:upload_csv"))
>
>
> On Thursday, September 27, 2018 at 1:59:24 PM UTC+5:30, Eric Pascual wrote:
>>
>> Hi,
>>
>>
>> Have you studied the documentation of the CSV module included in Python
>> standard library ?
>>
>>
>> You'll find there all the needed information for reading and interpreting
>> CSV files without having to implement the raw parsing, and have there rows
>> in a form ready to use for inserting objects in your model.
>>
>>
>> For performance's sake, it is advised to use bulk inserts or updates
>> instead on individual saves on the Django side if your CSV files contain a
>> lot of data.
>>
>>
>> Best
>>
>>
>> Eric
>> --
>> *From:* django...@googlegroups.com  on
>> behalf of BBG 
>> *Sent:* Wednesday, September 26, 2018 6:04:09 PM
>> *To:* Django users
>> *Subject:* Can anyone share code for uploading csv or excel file to
>> sqlite3 database.
>>
>> I want to create upload bulk data. Can anyone share code to upload csv or
>> excel file.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users...@googlegroups.com.
>> To post to this group, send email to djang...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/fc5736a8-3396-491b-b265-853f46fdad87%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/fc5736a8-3396-491b-b265-853f46fdad87%40googlegroups.com?utm_medium=email&utm_source=footer>
>>

Re: Can anyone share code for uploading csv or excel file to sqlite3 database.

2018-09-28 Thread Derek
There's blog article on Excel import here:

https://www.pythoncircle.com/post/591/how-to-upload-and-process-the-excel-file-in-django/


On Thursday, 27 September 2018 01:35:47 UTC+2, BBG wrote:
>
> I want to create upload bulk data. Can anyone share code to upload csv or 
> excel file. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/475083bc-c4ac-4bc1-80d4-0506cf949125%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can anyone share code for uploading csv or excel file to sqlite3 database.

2018-09-27 Thread BBG
I have tried this but not working

def upload_csv(request):
data = {}
if "GET" == request.method:
return render(request, "add_student/bulk.html", data)
# if not GET, then proceed
try:
csv_file = request.FILES["csv_file"]
if not csv_file.name.endswith('.csv'):
messages.error(request,'File is not CSV type')
return HttpResponseRedirect(reverse("add_student:upload_csv"))
#if file is too large, return
if csv_file.multiple_chunks():
messages.error(request,"Uploaded file is too big (%.2f MB)." % 
(csv_file.size/(1000*1000),))
return HttpResponseRedirect(reverse("add_student:upload_csv"))

file_data = csv_file.read().decode("utf-8")

lines = file_data.split("\n")
#loop over the lines and save them in db. If error , store as string 
and then display
for line in lines:
fields = line.split(",")
data_dict = {}
data_dict["enrollment_no"] = fields[0]
data_dict["student_name"] = fields[1]
data_dict["gender"] = fields[2]
data_dict["course"] = fields[3]
data_dict["category"] = fields[4]
data_dict["admission_year"] = fields[5]
data_dict["branch"] = fields[6]
data_dict["current_semester"] = fields[7]
data_dict["address"] = fields[8]
data_dict["city"] = fields[9]
data_dict["district"] = fields[10]
data_dict["state"] = fields[11]
data_dict["student_contact"] = fields[12]
data_dict["parent_contact"] = fields[13]
try:
form = EventsForm(data_dict)
if form.is_valid():
form.save()
else:

logging.getLogger("error_logger").error(form.errors.as_json())
except Exception as e:
logging.getLogger("error_logger").error(repr(e))
pass
except Exception as e:
logging.getLogger("error_logger").error("Unable to upload file. 
"+repr(e))
messages.error(request,"Unable to upload file. "+repr(e))

return HttpResponseRedirect(reverse("add_student:upload_csv"))


On Thursday, September 27, 2018 at 1:59:24 PM UTC+5:30, Eric Pascual wrote:
>
> Hi,
>
>
> Have you studied the documentation of the CSV module included in Python 
> standard library ? 
>
>
> You'll find there all the needed information for reading and interpreting 
> CSV files without having to implement the raw parsing, and have there rows 
> in a form ready to use for inserting objects in your model. 
>
>
> For performance's sake, it is advised to use bulk inserts or updates 
> instead on individual saves on the Django side if your CSV files contain a 
> lot of data.
>
>
> Best
>
>
> Eric
> --
> *From:* django...@googlegroups.com  <
> django...@googlegroups.com > on behalf of BBG <
> bhavik@gmail.com >
> *Sent:* Wednesday, September 26, 2018 6:04:09 PM
> *To:* Django users
> *Subject:* Can anyone share code for uploading csv or excel file to 
> sqlite3 database. 
>  
> I want to create upload bulk data. Can anyone share code to upload csv or 
> excel file. 
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to djang...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/fc5736a8-3396-491b-b265-853f46fdad87%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/fc5736a8-3396-491b-b265-853f46fdad87%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/88ea4342-f61d-4282-99d2-511f7e9f14a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Can anyone share code for uploading csv or excel file to sqlite3 database.

2018-09-27 Thread PASCUAL Eric
Hi,


Have you studied the documentation of the CSV module included in Python 
standard library ?


You'll find there all the needed information for reading and interpreting CSV 
files without having to implement the raw parsing, and have there rows in a 
form ready to use for inserting objects in your model.


For performance's sake, it is advised to use bulk inserts or updates instead on 
individual saves on the Django side if your CSV files contain a lot of data.


Best


Eric


From: django-users@googlegroups.com  on behalf 
of BBG 
Sent: Wednesday, September 26, 2018 6:04:09 PM
To: Django users
Subject: Can anyone share code for uploading csv or excel file to sqlite3 
database.

I want to create upload bulk data. Can anyone share code to upload csv or excel 
file.

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fc5736a8-3396-491b-b265-853f46fdad87%40googlegroups.com<https://groups.google.com/d/msgid/django-users/fc5736a8-3396-491b-b265-853f46fdad87%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/VI1P193MB0432BA7E9175A8B8D12BF05A8C140%40VI1P193MB0432.EURP193.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.


Can anyone share code for uploading csv or excel file to sqlite3 database.

2018-09-26 Thread BBG
I want to create upload bulk data. Can anyone share code to upload csv or 
excel file. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fc5736a8-3396-491b-b265-853f46fdad87%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Beginner problem with sqlite3 db

2018-09-18 Thread Mateusz
Cześć! ;)

You should first answer a question, why do you even bother using dbshell 
when there's an other option to deal with data? (docs 
<https://docs.djangoproject.com/en/2.1/intro/tutorial02/#playing-with-the-api>
)
If you know why I'm asking, simply installing sqlite3 is gonna be the best 
option for you (download page <https://www.sqlite.org/download.html>).


W dniu wtorek, 18 września 2018 01:38:57 UTC+2 użytkownik Robert 
Latoszewski napisał:
>
> Hi, 
> I'm going through "Writing your first Django app, part 2" link 
> <https://docs.djangoproject.com/en/2.1/intro/tutorial02/#database-setup> and 
> I have problem with sqlite3 db - I have created database tables with 
> migrate command (got db.sqlite3 file in my project folder) and I would like 
> to display those tables and have already tried milion ways with .schema 
> command but none of them worked. Any ideas what can be the problem? I 
> haven't installed sqlite3 beacuse documentation says that it's already 
> preinstalled with django, althoug when I tried "py manage.py dbshell" 
> command error appeared: "You appear not to have the 'sqlite3' program 
> installed or on your path."
> Django==2.1.1 on Windows (tried to see this db with Powershell). 
> Any help will be appreciated. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2b5b0b1f-1564-47f2-851f-aeabb2536318%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Beginner problem with sqlite3 db

2018-09-17 Thread Robert Latoszewski
Hi, 
I'm going through "Writing your first Django app, part 2" link 
<https://docs.djangoproject.com/en/2.1/intro/tutorial02/#database-setup> and 
I have problem with sqlite3 db - I have created database tables with 
migrate command (got db.sqlite3 file in my project folder) and I would like 
to display those tables and have already tried milion ways with .schema 
command but none of them worked. Any ideas what can be the problem? I 
haven't installed sqlite3 beacuse documentation says that it's already 
preinstalled with django, althoug when I tried "py manage.py dbshell" 
command error appeared: "You appear not to have the 'sqlite3' program 
installed or on your path."
Django==2.1.1 on Windows (tried to see this db with Powershell). 
Any help will be appreciated. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dd9cad0c-c78e-47bb-abb0-bd6493e6c52d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django sqlite3 error

2018-08-23 Thread Benjamin Goldberg
I think people need to see what your music_result table looks like before 
replying

On Thursday, August 23, 2018 at 2:35:04 AM UTC-4, ruban bharath wrote:
>
> Hi these are my tables
>
> music_name = char(username),userId(int)
>
> meaning = char(meaning),userid(int)
>
> i have used the join to merge this
>
> db = sqlite3.connect('db.sqlite3')
> cursor = db.cursor()
>
> cursor.execute('\n'
>
>'INSERT INTO  music_result SELECT username, meaning 
> ,NULL\n'
>
>'FROM music_name N JOIN music_sample1 T ON N.userid = 
> T.userid \n')
> db.commit()
>
> when i tried to do this i got an error like
>
> *sqlite3.IntegrityError: datatype mismatch*
>
> please do help me to solve this error
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/10a3aec5-bf81-4524-9f3a-5d6534ada51e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django sqlite3 error

2018-08-23 Thread Jason
What C. Kirby said.

I don't see any use of django in this question, and if you are interested 
in using it, I would look at the tutorial in the documentation for an 
introduction to the ORM.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b7919388-f17f-4d0d-8400-fcf5fb519592%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django sqlite3 error

2018-08-23 Thread C. Kirby
You are not using django anywhere in this question. I would send this to a 
python or sqlite group

On Thursday, August 23, 2018 at 2:35:04 AM UTC-4, ruban bharath wrote:
>
> Hi these are my tables
>
> music_name = char(username),userId(int)
>
> meaning = char(meaning),userid(int)
>
> i have used the join to merge this
>
> db = sqlite3.connect('db.sqlite3')
> cursor = db.cursor()
>
> cursor.execute('\n'
>
>'INSERT INTO  music_result SELECT username, meaning 
> ,NULL\n'
>
>'FROM music_name N JOIN music_sample1 T ON N.userid = 
> T.userid \n')
> db.commit()
>
> when i tried to do this i got an error like
>
> *sqlite3.IntegrityError: datatype mismatch*
>
> please do help me to solve this error
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fc1fee9b-d625-4f30-b5ff-dc14022090fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django sqlite3 error

2018-08-22 Thread ruban bharath


Hi these are my tables

music_name = char(username),userId(int)

meaning = char(meaning),userid(int)

i have used the join to merge this

db = sqlite3.connect('db.sqlite3')
cursor = db.cursor()

cursor.execute('\n'

   'INSERT INTO  music_result SELECT username, meaning 
,NULL\n'

   'FROM music_name N JOIN music_sample1 T ON N.userid = 
T.userid \n')
db.commit()

when i tried to do this i got an error like

*sqlite3.IntegrityError: datatype mismatch*

please do help me to solve this error

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fe247615-ee16-49ff-833f-590fc2f9d602%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Data Retrieval from sqlite3

2018-08-19 Thread ruban bharath
Thank you sir , i got a solution for this 

On Thursday, August 16, 2018 at 5:40:29 PM UTC+5:30, Vikrant Gupta wrote:
>
> Hello Ruban,
>
> Your code may be something like this 
>
> var=‘d’ #input from HTML
> Ans=models.objects.get(name=var)
> Print(Ans.batch)
>
> By,
> Vikrant
>
> On Aug 16, 2018, at 4:30 PM, ruban bharath  > wrote:
>
> *Name batch*
> a  one
> b  two
> c  three
> d  four
> e  five
>
> This is my  table
>
> If i entered "*d*" in the front end (html)
>
> my expected output must be like 
>
> d  four
>
> what is the django sqlite3 query to make run of it please do help me to 
> come out from this ?
>
> Thank you in advance
>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/e102d8f6-bf73-4d37-b75b-95bc0254a551%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/e102d8f6-bf73-4d37-b75b-95bc0254a551%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9706436b-d83e-4ef1-a1aa-3792cc3c24a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Data Retrieval from sqlite3

2018-08-16 Thread Vikrant Gupta
Hello Ruban,

Your code may be something like this 

var=‘d’ #input from HTML
Ans=models.objects.get(name=var)
Print(Ans.batch)

By,
Vikrant

> On Aug 16, 2018, at 4:30 PM, ruban bharath  wrote:
> 
> Name batch
> a  one
> b  two
> c  three
> d  four
> e  five
> 
> This is my  table
> 
> If i entered "d" in the front end (html)
> 
> my expected output must be like 
> 
> d  four
> 
> what is the django sqlite3 query to make run of it please do help me to come 
> out from this ?
> 
> Thank you in advance
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com 
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com 
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users 
> <https://groups.google.com/group/django-users>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/e102d8f6-bf73-4d37-b75b-95bc0254a551%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/e102d8f6-bf73-4d37-b75b-95bc0254a551%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4E13049E-9462-4706-B8EA-FD15F74CC938%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Data Retrieval from sqlite3

2018-08-16 Thread ruban bharath


cursor.execute('SELECT * FROM music_output WHERE username =?', t)
name2 = cursor.fetchall()
return render(request, "home.html", {'name3': name2})


This one suits me a error for using that *"?" how can i pass parameter  to 
get dynamic input*
thats my problem sir

 

On Thursday, August 16, 2018 at 4:41:07 PM UTC+5:30, Jason wrote:
>
> I would suggest you go through the django tutorial at 
> https://docs.djangoproject.com/en/2.1/intro/tutorial01/
>
> Your question suggests that you haven't done so, and it should help you 
> find the answer to your question.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4ce78e67-a293-4f0b-af9e-c9fe84db8610%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Data Retrieval from sqlite3

2018-08-16 Thread Jason
I would suggest you go through the django tutorial at 
https://docs.djangoproject.com/en/2.1/intro/tutorial01/

Your question suggests that you haven't done so, and it should help you 
find the answer to your question.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b4877b48-cc96-4700-a86d-4c03a5c2d532%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Data Retrieval from sqlite3

2018-08-16 Thread ruban bharath
*Name batch*
a  one
b  two
c  three
d  four
e  five

This is my  table

If i entered "*d*" in the front end (html)

my expected output must be like 

d  four

what is the django sqlite3 query to make run of it please do help me to 
come out from this ?

Thank you in advance

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e102d8f6-bf73-4d37-b75b-95bc0254a551%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Admin with SQLite3 :memory:

2018-08-02 Thread George Kontridze
Hello,

I was wondering if it is possible to use SQLite3 with the :memory: option
in conjunction with Django Admin. I have gone as far as creating and
running migrations on startup, and I can see that the auth_user table gets
created, but when I try to log into the admin web interface, I get an
exception with the "no such table auth_user".

Is it possible that the runtime had limited access to SQLite3 :memory:, and
some parts of the framework are outside of that scope?

I understand that this is an unusual setup, but I would appreciate any
insight into my situation. For now I've switched to a separate database
server, but would still like to implement this feature, if possible.

Thanks,
- George

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMqEuk-sgg8V2VH%3D_szXCwuu%2BU6YHkVuZiAaJzrhG4KJ5H4fUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


help in understanding the sqlite3 backend

2018-07-07 Thread Sumit J
Hello,

I am trying to understand the sqlite3 backend, especially the 
register_converter part.

I wanted to understand why are those converters put in place?
I commented out this registration and even then was able to to query the 
database in django shell via the ORM..
Even raw query execution returned correct results.

Is it there to maintain backward compatibility ? (guessing)

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/047f179e-8d10-4752-8a67-7480d5a7074f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading from 1.11 to 2.0: "sqlite3.OperationalError: no such table"

2018-05-08 Thread Informatico Neurodesarrollo

Check 1.11 to 2.0 upgrade.
You already checked the project configuration and make migrations ?, it 
could be changed with the upgrade!!!

I will hope help you.

PD I'm a beginner in Django.

El 06/05/18 a las 23:38, Michael Gauland escribió:
Just in case anyone else runs into this, I fixed it by specifying 
db_contraint=False for foreign keys which cross databases.

--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
.
To post to this group, send email to django-users@googlegroups.com 
.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aaca2372-f0f3-4e60-98cc-b7f906867606%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--

Jesús Reyes Piedra
Admin Red Neurodesarrollo,Cárdenas
La caja decía:"Requiere windows 95 o superior"...
Entonces instalé LINUX.



--
Este mensaje le ha llegado mediante el servicio de correo electronico que 
ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema 
Nacional de Salud. La persona que envia este correo asume el compromiso de usar 
el servicio a tales fines y cumplir con las regulaciones establecidas

Infomed: http://www.sld.cu/

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5AF1F35F.8060903%40infomed.sld.cu.
For more options, visit https://groups.google.com/d/optout.


Re: Upgrading from 1.11 to 2.0: "sqlite3.OperationalError: no such table"

2018-05-06 Thread Michael Gauland
Just in case anyone else runs into this, I fixed it by specifying 
db_contraint=False for foreign keys which cross databases.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aaca2372-f0f3-4e60-98cc-b7f906867606%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Upgrading from 1.11 to 2.0: "sqlite3.OperationalError: no such table"

2018-05-03 Thread Michael Gauland
I've got a project that's been developed using django 1.11. I've tried 
upgrading to 2.0, but now I'm getting an error I haven't been able to track 
down.

My database engine is sqlite3. I have three database files:
  - db.sqlite3 is the default. This is the only one that django manages, 
and the only one that is writable.
  - components.sqlite3 contains a library of engineering component data. 
  - slat_constants.sqlite3 contains constants used by the project. In 
particular, the 'slat_locations' table holds information about sites in NZ.

I have a Model that exposes the location data:
class Location(models.Model):
location = models.CharField(max_length=128)
z = models.FloatField()
min_distance = models.FloatField(null = True)
max_disstance = models.FloatField(null = True)

class Meta:
managed = False
db_table = 'slat_location'

and another that uses it:
class NZ_Standard_Curve(models.Model):
SOIL_CLASS_A = 'A'
SOIL_CLASS_B = 'B'
SOIL_CLASS_C = 'C'
SOIL_CLASS_D = 'D'
SOIL_CLASS_E = 'E'
SOIL_CLASS_CHOICES = (
(SOIL_CLASS_A, 'A'),
(SOIL_CLASS_B, 'B'),
(SOIL_CLASS_C, 'C'),
(SOIL_CLASS_D, 'D'),
(SOIL_CLASS_E, 'E')
)

soil_class = models.CharField(max_length=1,
  choices=SOIL_CLASS_CHOICES,
  default=SOIL_CLASS_A)
period = models.FloatField(default=1.5)
location = models.ForeignKey(Location, on_delete=PROTECT, 
null=False)

...and a test script that creates an NZ_Standard_Curve, and tries to save 
it:

location = Location.objects.get(location='Christchurch')
curve = NZ_Standard_Curve(location=location, 
   soil_class='C',
   period=1.5)
curve.save()

If I don't try to save the curve, the test passes. The save() call fails 
with:

sqlite3.OperationalError: no such table: main.slat_location

Again, this all works with django 1.11.13. I've tried creating a fresh 
database, and making new migrations, but that hasn't helped. 

I've wondered if the leading 'main.' in the table name is a clue, but that 
hasn't led me anywhere yet.

Any suggestions? 

Kind Regards,
Michael Gauland

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7f89596e-c7f0-44ff-a13f-a5779701a80a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3.NotSupportedError: URIs not supported

2018-02-26 Thread Dylan Reinhold
The original email was from 2 years ago, So I'm sure a lot has changed.

Dylan

On Mon, Feb 26, 2018 at 12:49 PM, Samantha Atkins 
wrote:

> Well this is useless to those of us actually on python3.  Exactly what
> version of what fixeds this issue *for* python3?
>
> On Wednesday, August 24, 2016 at 1:16:53 PM UTC-7, Jeff Silverman wrote:
>>
>> Can anyone point me in the right direction to solve this?  I am running
>> DJANGO with python3.4 in virtualenv.  I get this error running manage.py.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/d7d57761-707a-4aa4-b84a-510d964c16d5%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHtg44BaCF0iFEm1475Wx98okYtNzBPuf%2BKF4gSH5RRRg%3DhMBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3.NotSupportedError: URIs not supported

2018-02-26 Thread Samantha Atkins
Well this is useless to those of us actually on python3.  Exactly what 
version of what fixeds this issue *for* python3?

On Wednesday, August 24, 2016 at 1:16:53 PM UTC-7, Jeff Silverman wrote:
>
> Can anyone point me in the right direction to solve this?  I am running 
> DJANGO with python3.4 in virtualenv.  I get this error running manage.py.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d7d57761-707a-4aa4-b84a-510d964c16d5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django migrating from sqlite3 to oracle gives error ORA-02000

2018-02-09 Thread Jani Tiainen
Hi.

Could you give full traceback and preferably migration code that fails.

Just Oracle error code isn't enough to help you.

9.2.2018 23.12 "Mohamed Saleh"  kirjoitti:

> I hava a Django app on a windows server 2012 which was set up with sqlite3
> as the db, but it's going to production so I'm migrating the tables to
> oracle 12c on the server, i don't care about the data just the tables so
> when I run
>
> python manage.py migrate
>
> I get ORA-2000 Error: missing ALWAYS keyword
>
> I'm new to django, what am i missing?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/cac7bf33-deb0-422c-870c-c0c6f0e5f5c1%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/cac7bf33-deb0-422c-870c-c0c6f0e5f5c1%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91oe8FnMFAynYG8VGbqgHNusoDbaDw1dc5TemPai6Tnn%2BPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


django migrating from sqlite3 to oracle gives error ORA-02000

2018-02-09 Thread Mohamed Saleh


I hava a Django app on a windows server 2012 which was set up with sqlite3 
as the db, but it's going to production so I'm migrating the tables to 
oracle 12c on the server, i don't care about the data just the tables so 
when I run

python manage.py migrate

I get ORA-2000 Error: missing ALWAYS keyword

I'm new to django, what am i missing?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cac7bf33-deb0-422c-870c-c0c6f0e5f5c1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to create path for sqlite3 in django? I'm unable to access my database.

2017-10-30 Thread Etienne Robillard

Hi,

you may need to install sqlite3 for windows and set your PATH to the 
directory where sqlite3 executable is found.


Etienne


Le 2017-10-30 à 03:52, bonagiri abhishek a écrit :

C:\Users\admin\cricwebsite>python manage.py dbshell
CommandError: You appear not to have the 'sqlite3' program installed 
or on your path.

Can anyone please explain me the problem?
I'm unable to access the database as it is showing the above CommandError.
--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to django-users+unsubscr...@googlegroups.com 
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com 
<mailto:django-users@googlegroups.com>.

Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e9a5e8c3-02b7-45f4-9fcd-6e7f5edd8ea5%40googlegroups.com 
<https://groups.google.com/d/msgid/django-users/e9a5e8c3-02b7-45f4-9fcd-6e7f5edd8ea5%40googlegroups.com?utm_medium=email&utm_source=footer>.

For more options, visit https://groups.google.com/d/optout.


--
Etienne Robillard
tkad...@yandex.com
http://www.isotopesoftware.ca/

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e4e6d0d9-25ea-aeb3-8bf6-25c5efca77c8%40yandex.com.
For more options, visit https://groups.google.com/d/optout.


how to create path for sqlite3 in django? I'm unable to access my database.

2017-10-30 Thread bonagiri abhishek
C:\Users\admin\cricwebsite>python manage.py dbshell
CommandError: You appear not to have the 'sqlite3' program installed or on 
your path.
Can anyone please explain me the problem?
I'm unable to access the database as it is showing the above CommandError.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e9a5e8c3-02b7-45f4-9fcd-6e7f5edd8ea5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 table not found

2017-05-22 Thread jjanderson52000

James,

I will read up on dbshell and give it a try. Thanks for the pointer.

Yes, I ran both 'makemigrations' and 'migrate' prior to posting.

If I can figure out how to close out the thread, I will.

Jim A.

On Sunday, May 21, 2017 at 12:03:42 PM UTC-4, James Schneider wrote:
>
>
>
> On May 21, 2017 8:49 AM, > wrote:
>
>
> Hi,
>
> I'm fairly new to Django and I'm very much still in the learning process.
>
>
>
> I'm using Django 1.10.3 on a project and have just added some new models. 
> When I run the server and enter a URL to visit one of my views, I get an 
> error, an excerpt of which is shown below:
>
> File 
> "/home/jja/testenv3.5/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py",
>  
> line 337, in execute
> return Database.Cursor.execute(self, query, params)
> sqlite3.OperationalError: no such table: siggy_siggytemplate
>
> I would like to look at the SQL tables and it looks like 'python manage.py 
> sql' is a command that could do the job, but whichh is no longer available. 
> Is this correct?
>
> Is there an alternative command that I can run?\
>
>
> I believe you're looking for the 'dbshell' command, which will open the 
> sqlite shell for you.
>
>
> I would like to look at the tables to see if I can figure out why the 
> table 'siggy_siggytemplate' was not generated. BTW, my project is 'siggy' 
> and my model is 'SiggyTemplate' so I think this would cause generation of 
> the table 
> 'siggy_siggytemplate'.
>
>
> Did you run the 'makemigrations' and 'migrate' commands? That pair of 
> commands will apply your changes to the DB schema.
>
> -James
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ba78993e-02c4-479b-8508-6da22b538c26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 table not found

2017-05-21 Thread James Schneider
On May 21, 2017 8:49 AM,  wrote:


Hi,

I'm fairly new to Django and I'm very much still in the learning process.



I'm using Django 1.10.3 on a project and have just added some new models.
When I run the server and enter a URL to visit one of my views, I get an
error, an excerpt of which is shown below:

File "/home/jja/testenv3.5/lib/python3.5/site-packages/
django/db/backends/sqlite3/base.py", line 337, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: siggy_siggytemplate

I would like to look at the SQL tables and it looks like 'python manage.py
sql' is a command that could do the job, but whichh is no longer available.
Is this correct?

Is there an alternative command that I can run?\


I believe you're looking for the 'dbshell' command, which will open the
sqlite shell for you.


I would like to look at the tables to see if I can figure out why the table
'siggy_siggytemplate' was not generated. BTW, my project is 'siggy' and my
model is 'SiggyTemplate' so I think this would cause generation of the
table
'siggy_siggytemplate'.


Did you run the 'makemigrations' and 'migrate' commands? That pair of
commands will apply your changes to the DB schema.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciUEmJ1cmbSvPH4P2US9V8k0TcZgWed4o351BsBOGhPHRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


sqlite3 table not found

2017-05-21 Thread jjanderson52000

Hi,

I'm fairly new to Django and I'm very much still in the learning process.



I'm using Django 1.10.3 on a project and have just added some new models. 
When I run the server and enter a URL to visit one of my views, I get an 
error, an excerpt of which is shown below:

File 
"/home/jja/testenv3.5/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py",
 
line 337, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: siggy_siggytemplate

I would like to look at the SQL tables and it looks like 'python manage.py 
sql' is a command that could do the job, but whichh is no longer available. 
Is this correct?

Is there an alternative command that I can run?\

I would like to look at the tables to see if I can figure out why the table 
'siggy_siggytemplate' was not generated. BTW, my project is 'siggy' and my 
model is 'SiggyTemplate' so I think this would cause generation of the 
table 
'siggy_siggytemplate'.

Jim Anderson

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f0899f11-f9f8-4ce9-886b-86d934f0c41a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 database encrytion for Django.

2017-05-09 Thread Melvyn Sopacua
On Tuesday 09 May 2017 09:24:08 Antonis Christofides wrote:
> > and root seems (unsurprisingly) able to do anything desired with the
> > database.
> 
> He meant that root wouldn't be able to read the database if the
> database was encrypted. But, again, the question is whether root
> would have access to the encryption keys. If the django user has
> access to the encryption keys, root also does.

Defending against a targetted attack is extremely hard. It's also a minute 
percentage of the 
attacks out there. A site may never see one as it's simply not worth the effort.

By putting the encryption keys on a networked resource, you defend against 
exploits that make 
everything they can see world-readable (which will go unnoticed far more then 
it should and 
can have great pay outs). Or for example a compromised ftp daemon that can now 
hand you 
the file it normally wouldn't.
The vast majority of security attacks are wide scans for known failures, which 
try to create as 
much yield as possible with the least ammount of detection. This is because it 
takes time to 
follow-up on the success of the hack.
For example, I've dealt with an exploit that infected all files with a redirect 
- but - only when 
viewed on a mobile device. Not because it wanted to infect mobile devices, but 
simply because 
it would go unnoticed much longer, especially by the people that work with it 
daily.

> What I'm getting at is that the benefits of encrypting the database
> are questionable.

That can be said about any encryption, as everything can be decrypted given 
enough time and 
resources - a fact that not enough people say out loud. The assumption is that 
at the time it is 
decrypted the information is no longer relevant.

> Maybe there is some edge case in which it would be
> useful.

It's useful for the majority of cases. Every hurdle - every deviation from the 
defaults or 
commonly used conventions helps against those wide-targgetted scanners. Just 
look at your 
webserver logs how many of those fail just because you didn't make phpMyAdmin 
available in 
one of the common aliases. And think how many succeed because they run vanilla 
Ubuntu and 
never actually made an effort to think about this stuff.

Now, there's even a totally different use case. Say, I want make answers to 
exams available, 
but only after the exam. Using time-lapse cryptography[1], I can make the 
answers only 
available after a certain time :).

Anyway - there's enough food for thought in here, so I'm out, unless the OP 
explains his use 
case and needs more help.
-- 
Melvyn Sopacua


[1] https://crypto.stackexchange.com/a/3072

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4099429.zBxrgMXHrk%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 database encrytion for Django.

2017-05-08 Thread Antonis Christofides
> and root seems (unsurprisingly) able to do anything desired with the
> database.
He meant that root wouldn't be able to read the database if the database was
encrypted. But, again, the question is whether root would have access to the
encryption keys. If the django user has access to the encryption keys, root also
does.

What I'm getting at is that the benefits of encrypting the database are
questionable. Maybe there is some edge case in which it would be useful. I am no
security specialist, but the thing is, unless you are a security specialist and
really know what you are doing, encrypting your database would probably not
achieve much, or it might even make things worse.

Antonis Christofides
http://djangodeployment.com


On 2017-05-08 20:40, Tim Chase wrote:
> On 2017-05-08 18:26, Melvyn Sopacua wrote:
>>> What would you gain by encrypting it?
>> Three things:
>> 1) If the file gets deleted, Django does not recreate it with that
>> mode. Solvable by using a dedicated directory instead of the above.
> I'm not sure I see this as a benefit, but if rogue processes are
> deleting your database, the permissions upon recreation would be the
> least of my worries. ;-)
>
>> 2) root can't do anything with it nor can daemons that are
>> compromised before switching to unprivileged user.
> You sure about this?  I just tested the scenario:
>
>   $ su -
>   Password: 
>   root@laptop:~# sqlite3 test.db
>   SQLite version 3.8.7.1 2014-10-29 13:59:56
>   Enter ".help" for usage hints.
>   sqlite> create table example (id int);
>   sqlite> insert into example values (42);
>   sqlite> select * from example;
>   42
>   sqlite> 
>   root@laptop:~# chown tim:tim test.db
>   root@laptop:~# chmod 600 test.db
>   root@laptop:~# ls -lsF test.db
>   4 -rw--- 1 tim tim 2048 May  8 12:33 test.db
>   root@laptop:~# sqlite3 test.db
>   SQLite version 3.8.7.1 2014-10-29 13:59:56
>   Enter ".help" for usage hints.
>   sqlite> select * from example;
>   42
>   sqlite> delete from example;
>   sqlite>
>
> and root seems (unsurprisingly) able to do anything desired with the
> database.
>
>> 3) Additional layer in case martians invade earth and other things
>> that should not happen. Not uncommon in high-security environments
>> to defend against the unknown. See for example the requirements
>> FIPS-140[1] places on access to cryptographic keys, even though we
>> all put them in a directory mode 500 owned by root.
> While conceivable, you still have to have the decryption keys
> available to the Django process to be able to decrypt the values.
> Theoretically, one could load the keys off a removable device into a
> single Django process, then unmount/remove the external device.  But
> if you have Django processes spinning up with load increase, you'd
> have to have the keys available to them.
>
> Otherwise, as a recent "whoops, I deleted my source code, so I
> salvaged it from the process that was currently running that code"
> article[1] suggests, one can also attach to a running process that
> would grant access to the decrypting keys in memory, even if the
> theoretical external device has been removed.
>
> Security is hard. :-)
>
>> But I feel we're going off-topic now.
> Maybe, maybe not. :-)
>
> -tkc
>
>
> [1] https://gist.github.com/simonw/8aa492e59265c1a021f5c5618f9e6b12
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fc46dd1d-d370-51c2-6099-9dc5cdc0e39b%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 database encrytion for Django.

2017-05-08 Thread Tim Chase
On 2017-05-08 18:26, Melvyn Sopacua wrote:
> > What would you gain by encrypting it?
> 
> Three things:
> 1) If the file gets deleted, Django does not recreate it with that
> mode. Solvable by using a dedicated directory instead of the above.

I'm not sure I see this as a benefit, but if rogue processes are
deleting your database, the permissions upon recreation would be the
least of my worries. ;-)

> 2) root can't do anything with it nor can daemons that are
> compromised before switching to unprivileged user.

You sure about this?  I just tested the scenario:

  $ su -
  Password: 
  root@laptop:~# sqlite3 test.db
  SQLite version 3.8.7.1 2014-10-29 13:59:56
  Enter ".help" for usage hints.
  sqlite> create table example (id int);
  sqlite> insert into example values (42);
  sqlite> select * from example;
  42
  sqlite> 
  root@laptop:~# chown tim:tim test.db
  root@laptop:~# chmod 600 test.db
  root@laptop:~# ls -lsF test.db
  4 -rw--- 1 tim tim 2048 May  8 12:33 test.db
  root@laptop:~# sqlite3 test.db
  SQLite version 3.8.7.1 2014-10-29 13:59:56
  Enter ".help" for usage hints.
  sqlite> select * from example;
  42
  sqlite> delete from example;
  sqlite>

and root seems (unsurprisingly) able to do anything desired with the
database.

> 3) Additional layer in case martians invade earth and other things
> that should not happen. Not uncommon in high-security environments
> to defend against the unknown. See for example the requirements
> FIPS-140[1] places on access to cryptographic keys, even though we
> all put them in a directory mode 500 owned by root.

While conceivable, you still have to have the decryption keys
available to the Django process to be able to decrypt the values.
Theoretically, one could load the keys off a removable device into a
single Django process, then unmount/remove the external device.  But
if you have Django processes spinning up with load increase, you'd
have to have the keys available to them.

Otherwise, as a recent "whoops, I deleted my source code, so I
salvaged it from the process that was currently running that code"
article[1] suggests, one can also attach to a running process that
would grant access to the decrypting keys in memory, even if the
theoretical external device has been removed.

Security is hard. :-)

> But I feel we're going off-topic now.

Maybe, maybe not. :-)

-tkc


[1] https://gist.github.com/simonw/8aa492e59265c1a021f5c5618f9e6b12





-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20170508124034.45f06075%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 database encrytion for Django.

2017-05-08 Thread Melvyn Sopacua
On Monday 08 May 2017 18:29:35 Antonis Christofides wrote:
> Assume Django is running as user 'django' and the db is "db.sqlite3".
> 
> If you "chown django db.sqlite3" and "chmod 600 db.sqlite3", only user
> django can access it.
> 
> What would you gain by encrypting it?

Three things:
1) If the file gets deleted, Django does not recreate it with that mode. 
Solvable by using a 
dedicated directory instead of the above.
2) root can't do anything with it nor can daemons that are compromised before 
switching to 
unprivileged user.
3) Additional layer in case martians invade earth and other things that should 
not happen. Not 
uncommon in high-security environments to defend against the unknown. See for 
example the 
requirements FIPS-140[1] places on access to cryptographic keys, even though we 
all put them 
in a directory mode 500 owned by root.

But I feel we're going off-topic now.
-- 
Melvyn Sopacua


[1] https://en.wikipedia.org/wiki/FIPS_140-2#Level_1

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2121782.v00QVscXm9%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 database encrytion for Django.

2017-05-08 Thread Antonis Christofides
Assume Django is running as user 'django' and the db is "db.sqlite3".

If you "chown django db.sqlite3" and "chmod 600 db.sqlite3", only user django
can access it.

What would you gain by encrypting it?

Antonis Christofides
http://djangodeployment.com

On 2017-05-08 18:06, Melvyn Sopacua wrote:
>
> On Monday 08 May 2017 17:35:59 Antonis Christofides wrote:
>
> > > Unfortunately, that doesn't prevent theft at runtime, which is the
>
> > > primary case for encrypting "documents". I used to do something
>
> > > like this with svn passwords, using a file-backed mdconfig store
>
> > > and geli.
>
> >
>
> > But during runtime, Django has access to the unencrypted database
>
> > (otherwise it wouldn't be able to work). So any attacker who has
>
> > managed to compromise Django
>
>  
>
> You assume Django is compromised. I don't. Could be the webserver. Could be
> some other application that exposes the file.
>
>  
>
> Another use case for encrypting the sqlite database is that it doesn't have
> authentication, so you cannot pass on login credentials to the database like
> you do with a "real" database system. This is one way for embedded systems to
> personalize devices without having to manage another server component.
>
>  
>
> With IoT security being under a microscope these days, I can see the
> potential. And from experience, Django runs fine on a Raspberry Pi and is an
> easy way to provide a user interface that is accessible from anywhere.
>
>  
>
> -- 
>
> Melvyn Sopacua
>
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com
> .
> To post to this group, send email to django-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/27229024.NH8PPNG8h5%40devstation
> .
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9cf0da7c-fe0f-0ea1-4f47-ebd2fc9d8a27%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 database encrytion for Django.

2017-05-08 Thread Melvyn Sopacua
On Monday 08 May 2017 17:35:59 Antonis Christofides wrote:
> > Unfortunately, that doesn't prevent theft at runtime, which is the
> > primary case for encrypting "documents". I used to do something
> > like this with svn passwords, using a file-backed mdconfig store
> > and geli.
> 
> But during runtime, Django has access to the unencrypted database
> (otherwise it wouldn't be able to work). So any attacker who has
> managed to compromise Django

You assume Django is compromised. I don't. Could be the webserver. Could be 
some other 
application that exposes the file.

Another use case for encrypting the sqlite database is that it doesn't have 
authentication, so 
you cannot pass on login credentials to the database like you do with a "real" 
database system. 
This is one way for embedded systems to personalize devices without having to 
manage 
another server component.

With IoT security being under a microscope these days, I can see the potential. 
And from 
experience, Django runs fine on a Raspberry Pi and is an easy way to provide a 
user interface 
that is accessible from anywhere.

-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27229024.NH8PPNG8h5%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 database encrytion for Django.

2017-05-08 Thread Antonis Christofides
> Unfortunately, that doesn't prevent theft at runtime, which is the primary
> case for encrypting "documents". I used to do something like this with svn
> passwords, using a file-backed mdconfig store and geli.
>
But during runtime, Django has access to the unencrypted database (otherwise it
wouldn't be able to work). So any attacker who has managed to compromise Django
will have access to the database. Could you describe a use case where the
encryption would actually prevent someone from reading the database?

Antonis Christofides
http://djangodeployment.com

On 2017-05-08 17:19, Melvyn Sopacua wrote:
>
> On Saturday 06 May 2017 11:56:28 Tim Chase wrote:
>
> > On 2017-05-05 11:51, agajesh...@atompower.com wrote:
>
> > > I want to encrypt my sqlite3 database such that it cannot be
>
> > > accessed without a key. I came across "sqlcipher" tool which
>
> > > provides encryption for sqlite3 database, but I couldn't find
>
> > > enough support to make it work from django.
>
> > >
>
> > > It would be very helpful if someone can share thoughts on how to
>
> > > encrypt sqlite3 database and be able to access the encrypted
>
> > > version through django.
>
> >
>
> > While there are other ideas presented in other replies to your email,
>
> > would it suffice to have an encrypted partition and put your database
>
> > on that partition? I configure my FreeBSD servers to be ZFS-on-GELI so
>
> > in the event the power goes out or the machine is rebooted, the
>
> > contents are unavailable until I enter the password on the console.
>
>  
>
> Unfortunately, that doesn't prevent theft at runtime, which is the primary
> case for encrypting "documents". I used to do something like this with svn
> passwords, using a file-backed mdconfig store and geli.
>
> -- 
>
> Melvyn Sopacua
>
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/3670040.JhOgCCftKx%40devstation
> <https://groups.google.com/d/msgid/django-users/3670040.JhOgCCftKx%40devstation?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/914eb0b2-988d-bbcd-cc2c-8822d7fdfa5e%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 database encrytion for Django.

2017-05-08 Thread Melvyn Sopacua
On Saturday 06 May 2017 11:56:28 Tim Chase wrote:
> On 2017-05-05 11:51, agajesh...@atompower.com wrote:
> > I want to encrypt my sqlite3 database such that it cannot be
> > accessed without a key. I came across "sqlcipher" tool which
> > provides encryption for sqlite3 database, but I couldn't find
> > enough support to make it work from django.
> > 
> > It would be very helpful if someone can share thoughts on how to
> > encrypt sqlite3 database and be able to access the encrypted
> > version through django.
> 
> While there are other ideas presented in other replies to your email,
> would it suffice to have an encrypted partition and put your database
> on that partition? I configure my FreeBSD servers to be ZFS-on-GELI so
> in the event the power goes out or the machine is rebooted, the
> contents are unavailable until I enter the password on the console.

Unfortunately, that doesn't prevent theft at runtime, which is the primary case 
for 
encrypting "documents". I used to do something like this with svn passwords, 
using a file-
backed mdconfig store and geli.
-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3670040.JhOgCCftKx%40devstation.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 database encrytion for Django.

2017-05-06 Thread Tim Chase
On 2017-05-05 11:51, agajesh...@atompower.com wrote:
> I want to encrypt my sqlite3 database such that it cannot be
> accessed without a key. I came across "sqlcipher" tool which
> provides encryption for sqlite3 database, but I couldn't find
> enough support to make it work from django. 
> 
> It would be very helpful if someone can share thoughts on how to
> encrypt sqlite3 database and be able to access the encrypted
> version through django.

While there are other ideas presented in other replies to your email,
would it suffice to have an encrypted partition and put your database
on that partition? I configure my FreeBSD servers to be ZFS-on-GELI so
in the event the power goes out or the machine is rebooted, the
contents are unavailable until I enter the password on the console.

-tkc



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20170506115628.00bd312e%40bigbox.christie.dr.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 database encrytion for Django.

2017-05-05 Thread Antonis Christofides
Hi,

That's interesting. May I ask why you want to do this?

Regards,

A.

Antonis Christofides
http://djangodeployment.com

On 2017-05-05 21:51, agajesh...@atompower.com wrote:
> Hello everyone,
>
> I want to encrypt my sqlite3 database such that it cannot be accessed without
> a key. I came across "sqlcipher" tool which provides encryption for sqlite3
> database, but I couldn't find enough support to make it work from django. 
>
> It would be very helpful if someone can share thoughts on how to encrypt
> sqlite3 database and be able to access the encrypted version through django.
>
> Thank you,
>
> -- 
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com
> <mailto:django-users+unsubscr...@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/18ffcee8-3ff1-4202-9143-cd446bc424cc%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/18ffcee8-3ff1-4202-9143-cd446bc424cc%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f94d7c44-d099-f269-517e-581433e751e8%40djangodeployment.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3 database encrytion for Django.

2017-05-05 Thread Malcolm MacKinnon
I suggest you consider using keyzar and django-encrypted-fields. Here's the
code: https://github.com/defrex/django-encrypted-fields/


On Fri, May 5, 2017 at 11:51 AM,  wrote:

> Hello everyone,
>
> I want to encrypt my sqlite3 database such that it cannot be accessed
> without a key. I came across "sqlcipher" tool which provides encryption for
> sqlite3 database, but I couldn't find enough support to make it work from
> django.
>
> It would be very helpful if someone can share thoughts on how to encrypt
> sqlite3 database and be able to access the encrypted version through django.
>
> Thank you,
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/18ffcee8-3ff1-4202-9143-cd446bc424cc%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/18ffcee8-3ff1-4202-9143-cd446bc424cc%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK8W3XoK5Q74dffTj-wtf8hb%2Bm9YQQNobxh0eW%2B2y2ki4b6yZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


sqlite3 database encrytion for Django.

2017-05-05 Thread agajeshwar
Hello everyone,

I want to encrypt my sqlite3 database such that it cannot be accessed 
without a key. I came across "sqlcipher" tool which provides encryption for 
sqlite3 database, but I couldn't find enough support to make it work from 
django. 

It would be very helpful if someone can share thoughts on how to encrypt 
sqlite3 database and be able to access the encrypted version through django.

Thank you,

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/18ffcee8-3ff1-4202-9143-cd446bc424cc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Anyone know howto solve this: Error loading either pysqlite2 or sqlite3 module

2017-02-19 Thread Fernando Ramirez Dominguez
Hello, everybody:

I am a newbie in Django and I recently installed Python 3.6 and Django 
1.110.5, but  when try execute the server show me:

{code}

Traceback (most recent call last):

  File 
"/root/myDjangoProject/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py",
 
line 34, in 

from pysqlite2 import dbapi2 as Database

ModuleNotFoundError: No module named 'pysqlite2'

{code}


My version CentOS is 6.8, python 3.6 and Django 1.10.5


Thanks a lot for your time

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/7d94a98f-1b82-4244-96a0-faf0cf00721e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django migrate generates SQLite3 file filled with junk

2016-09-25 Thread Lekan Wahab
On 25 Sep 2016 1:17 PM, "kbman99"  wrote:

>

> Just getting started with django and having an issue with the migrate.py
script. It generates a db.SQLite3 file which is filled with a lot of
garbage characters. It's in UTF-8 encoding, but looks like this.
>
> I've deleted the file and redone the migrate a few times but it's always
like this.
>
> Any help appreciated!
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
"Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/2980ce12-c366-454b-844a-c625e7520977%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/2980ce12-c366-454b-844a-c625e7520977%40googlegroups.com?utm_medium=email&utm_source=footer>
.
> For more options, visit https://groups.google.com/d/optout.
Hi kbman,
If you use PyCharm, you can easily read the sqlite3 file better with its
database integration.
Click on database.
Select from sources and then okay.

Lekan.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAE6v7ocEVu9CmHy7KGWJ0MV%3DMagVVQqZK%3DDAxPxqmhxWr_KrBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django migrate generates SQLite3 file filled with junk

2016-09-25 Thread Gergely Polonkai
That file is an SQLite database, which is a binary format. It should look
like this.

I know it is confusing, because of that bunch of SMS statements, but it's
OK that way. If you want to interact with it, use the sqlite3 command, or
an SQLite GUI.

On Sun, Sep 25, 2016, 14:17 kbman99  wrote:

> Just getting started with django and having an issue with the migrate.py
> script. It generates a db.SQLite3 file which is filled with a lot of
> garbage characters. It's in UTF-8 encoding, but looks like this.
>
> <https://i.gyazo.com/f962d9006cecf2ace0051181f1e88b77.png>
> I've deleted the file and redone the migrate a few times but it's always
> like this.
>
> Any help appreciated!
> Thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/2980ce12-c366-454b-844a-c625e7520977%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/2980ce12-c366-454b-844a-c625e7520977%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBU%2BLjg8hzYKKEKEdec9kWdWS1bfXSCdX0qsO0oxcppVX5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Django migrate generates SQLite3 file filled with junk

2016-09-25 Thread kbman99
Just getting started with django and having an issue with the migrate.py 
script. It generates a db.SQLite3 file which is filled with a lot of 
garbage characters. It's in UTF-8 encoding, but looks like this.


I've deleted the file and redone the migrate a few times but it's always 
like this.

Any help appreciated!
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2980ce12-c366-454b-844a-c625e7520977%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: sqlite3.NotSupportedError: URIs not supported

2016-08-24 Thread Jeff Silverman
Well I may have answered my own question. Seems it may be a version
incompatibility. I built another virtual environment at Python 2.7 and the
error is gone. Also I am using the pycontrol module which is also not work
g with Python 3.4.



On Wednesday, August 24, 2016, Jeff Silverman  wrote:

> Can anyone point me in the right direction to solve this?  I am running
> DJANGO with python3.4 in virtualenv.  I get this error running manage.py.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com
> 
> .
> To post to this group, send email to django-users@googlegroups.com
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/0bce8a95-b735-4f45-ad41-13f1e7429ed7%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAG09YoU0SLb-6YbDDaFLZ8f9Ff8L70YigxeHuZh2_SpvF9g1vw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


sqlite3.NotSupportedError: URIs not supported

2016-08-24 Thread Jeff Silverman
Can anyone point me in the right direction to solve this?  I am running 
DJANGO with python3.4 in virtualenv.  I get this error running manage.py.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0bce8a95-b735-4f45-ad41-13f1e7429ed7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


sqlite3 “OperationalError: no such table” on threaded operation

2016-01-08 Thread Jim Bell


By everything I read in the docs, both Django and py-sqlite3 should be fine 
with threaded access. (Right?) But the attached code snippet fails for me. 
The operations in the main thread work, but not in the thread(s) I create. 
There I get:

File 
"C:\Python27\lib\site-packages\django-1.9-py2.7.egg\django\db\backends\sq 
lite3\base.py", line 323, in execute return Database.Cursor.execute(self, 
query, params)

*OperationalError: no such table*: thrtest_mymodel

What's the problem?


How do I go about tracking down exactly what's happening? The point of 
failure in Django is pretty indimidating. I can't tell how to see what 
tables it DOES see, or what differences to look for between main and other 
threads.


Here is DATABASES from settings.py:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:', # os.path.join(BASE_DIR, 'db.sqlite3'),
'TEST_NAME' : ':memory:',
},}


With respect to Django's ticket #12118, I get the same symptoms using 
':memory:' or a disk file (for TEST_NAME).


Django 1.9, Python 2.7.11.


Posted yesterday on stackoverflow 
<http://stackoverflow.com/questions/34658231/django-sqlite3-operationalerror-no-such-table-on-threaded-operation>
.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9409d2f4-5530-4261-b501-c6833f39c735%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from django.db import models

# Super-simple model
class MyModel(models.Model):
   message   = models.CharField('Message', max_length=200, blank=True)

#Test
from django.test import TestCase

import time
import threading
import random


done = threading.Event()
nThreads = 1


def InsertRec(msg):
   rec = MyModel.objects.create(message=msg)
   rec.save()


def InsertThread():
   try:
  msgNum = 1
  thrName = threading.currentThread().name
  print 'Starting %s' % thrName
  while not done.wait(random.random() * 0.1):
 msgNum += 1
 msg = '%s: %d' % (thrName, msgNum)
 print msg
 InsertRec(msg)
   finally:
  done.set()
   pass


class ThreadTestRun(TestCase):

   def testRunIt(self):
  nThisThread = 10
  msgSet = set()
  for x in xrange(nThisThread):
 msg = 'Some message %d' % x
 InsertRec(msg) # From main thread: works!
 msgSet.add(msg)
  self.assertEqual(MyModel.objects.count(), nThisThread)
  # We use sets because .all() doesn't preserve the original order.
  self.assertEqual(msgSet, set([r.message for r in MyModel.objects.all()]))
  thrSet = set()
  for thrNum in xrange(nThreads):
 t = threading.Thread(name='Thread %d' % thrNum, target=InsertThread)
 t.start()
 thrSet.add(t)
  
  done.wait(10.)
  done.set()
  for t in thrSet:
 t.join()




Re: Can you remove a model's last field of SQLite3 in Django 1.8?

2015-11-29 Thread Markus Holtermann

No, you can't because of two things:

1. SQLite doesn't allow an 'ALTER TABLE ... DROP COLUMN ...'
  
  We get away with that by creating a new table and copying the data

  over: https://www.sqlite.org/lang_altertable.html

2. SQLite doesn't allow a 'CREATE TABLE' statement without any columns:
  https://www.sqlite.org/lang_createtable.html

/Markus

On Sun, Nov 29, 2015 at 09:17:53AM -0800, KwangYoun Jung wrote:

Can you remove a model's last field of SQLite3 in Django 1.8?

I have a model that has only one column in SQLite3.
When I remove a last field of the model, I get an error like below



*django.db.utils.OperationalError: near ")": syntax error*Anyone knows
about this issue ?

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/951e9cbd-2540-43eb-a951-6a3722f3ee3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20151129202807.GA10673%40pyler.local.
For more options, visit https://groups.google.com/d/optout.


Re: Can you remove a model's last field of SQLite3 in Django 1.8?

2015-11-29 Thread Daniel Roseman
On Sunday, 29 November 2015 17:17:54 UTC, KwangYoun Jung wrote:
>
> Can you remove a model's last field of SQLite3 in Django 1.8?
>
> I have a model that has only one column in SQLite3.
> When I remove a last field of the model, I get an error like below
>
>
>
> *django.db.utils.OperationalError: near ")": syntax error*Anyone knows 
> about this issue ?
>

No, nobody knows anything about this issue because you didn't give any 
details. What does "remove a last field" mean? When are you getting that 
error? What code did you run?
--
DR. 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2b4881ad-e68f-4279-9ab5-990e443b0a31%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Can you remove a model's last field of SQLite3 in Django 1.8?

2015-11-29 Thread KwangYoun Jung
Can you remove a model's last field of SQLite3 in Django 1.8?

I have a model that has only one column in SQLite3.
When I remove a last field of the model, I get an error like below



*django.db.utils.OperationalError: near ")": syntax error*Anyone knows 
about this issue ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/951e9cbd-2540-43eb-a951-6a3722f3ee3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Foreign key in sqlite3

2015-10-02 Thread Ricardo Daniel Quiroga
add foreign key in model, not in database, but it can cause conflicts with
django.
anyway if you even want to do it reviews the documentation SQLite

2015-09-30 13:12 GMT-03:00 Gergely Polonkai :

> Assuming you are using Django and it's ORM, the same way as in any other
> database:
>
> fieldname = models.ForeignKey(AnotherModel)
> On 30 Sep 2015 15:18, "Bhanu Kathuria" <001kathuriabh...@gmail.com> wrote:
>
>> I am using sqlite3 database.
>> How can I add foreign key between two tables.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/56c957c9-6b03-4c19-9566-9a63cdbf8319%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/56c957c9-6b03-4c19-9566-9a63cdbf8319%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACczBUKyATKexddYKEMhKyg4SpywuyZ7uMxDK5HMXxadQV7vLg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACczBUKyATKexddYKEMhKyg4SpywuyZ7uMxDK5HMXxadQV7vLg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Ricardo Daniel Quiroga

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO2-wHabpERhmoJGGRYJWxOee%2BWpKNQUpEn9ciBJ59AfJezRGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Foreign key in sqlite3

2015-09-30 Thread Gergely Polonkai
Assuming you are using Django and it's ORM, the same way as in any other
database:

fieldname = models.ForeignKey(AnotherModel)
On 30 Sep 2015 15:18, "Bhanu Kathuria" <001kathuriabh...@gmail.com> wrote:

> I am using sqlite3 database.
> How can I add foreign key between two tables.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/56c957c9-6b03-4c19-9566-9a63cdbf8319%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/56c957c9-6b03-4c19-9566-9a63cdbf8319%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CACczBUKyATKexddYKEMhKyg4SpywuyZ7uMxDK5HMXxadQV7vLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Foreign key in sqlite3

2015-09-30 Thread Bhanu Kathuria
I am using sqlite3 database.
How can I add foreign key between two tables.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56c957c9-6b03-4c19-9566-9a63cdbf8319%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sqlite3 to Postgres Migration?

2015-02-20 Thread Mike Dewhirst

On 21/02/2015 9:55 AM, talex wrote:

Thanks for your helpful comments.

Andrew, thanks for your migration article at http://afrg.co/updj17/a2 .
  It is slightly daunting for me at this point, but I may need to come
back to it later. Your book looks interesting.

Mike, thanks for the dump/load load suggestion.

For the moment, I think the easiest thing for me is to follow Thomas,
and just start over with Postgres, but let me explain more about what I
am doing and ask two more questions.

I am leading a project to create a web application for uploading certain
scientific data into a database.  No one in the group has experience
with web development.  We decided on Django, and I wrote a prototype
using sqlite3.  Sqlite3 will not be used going forward.   Instead either
Postgres or MySql will be used.  Personally I am in favor of Postgres,


Good call. IMO.


but I have been telling the group, perhaps incorrectly, that Django is
"database agnostic"


Correctly. https://docs.djangoproject.com/en/1.7/ref/databases/

and that we can easily change databases at any time

in the future should we need to do so.  So let me ask two more questions:

In the life of a Django application, is it simple and easy to change the
database flavor (say from Postgres to MySql), even after significant
data has accumulated in the model's database?


Probably easy but depends on your data. You need to do a comparison of 
data types supported to see if your task is covered by both. But even if 
not, you should be able to work around it with sleight of hand. This is 
independent of Django.




Does the answer change if we are willing to forgo the use of the
version-control-like capabilities represented by Django's
makemirations/migrate tools?


Not sure I understand the question. Switching from one database to 
another is not migrating in the sense that word is used in Django.


You probably wouldn't even need to use migrations anyway unless your 
models change. And you wouldn't want to conflate a model change with a 
database switch.


You would use PG Admin for "dumbing down" Postgres data types so it will 
become dump/loadable into Mysql.


Your real alternatives in switching databases are to do it with a 
shutdown or do it live. Django can handle multiple databases 
simultaneously so your options are legion!


I think the only valid reason for switching databases is if the one you 
chose is not doing the job.


Maybe your team is familiar with Mysql. If so, go with that. It is 
usually better for a leader to ask the team to do the research then 
choose the stack so that they have buy-in.


Cheers

Mike



Thanks.





--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/458baa37-5387-4784-97c2-c7cbb50fc480%40googlegroups.com
<https://groups.google.com/d/msgid/django-users/458baa37-5387-4784-97c2-c7cbb50fc480%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54E8309C.4020405%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Sqlite3 to Postgres Migration?

2015-02-20 Thread Andrew Farrell
One approach may be to use django-import-export
<https://django-import-export.readthedocs.org/en/latest/> to add to the
admin interface the capability to export your data to CSV (or JSON or
Excel) and likewise to import it.
Then, simply run two instances of your app: one on top of postgres, one on
top of sqlite. Export from one and import into the other.

Modifying the admin interface is probably not the fastest route to victory,
but if your application is centered around uploading and downloading data,
then you might decide that adding an "export to CSV" button is already
useful.

On Fri, Feb 20, 2015 at 4:55 PM, talex  wrote:

> Thanks for your helpful comments.
>
> Andrew, thanks for your migration article at http://afrg.co/updj17/a2 .
> It is slightly daunting for me at this point, but I may need to come back
> to it later. Your book looks interesting.
>
> Mike, thanks for the dump/load load suggestion.
>
> For the moment, I think the easiest thing for me is to follow Thomas, and
> just start over with Postgres, but let me explain more about what I am
> doing and ask two more questions.
>
> I am leading a project to create a web application for uploading certain
> scientific data into a database.  No one in the group has experience with
> web development.  We decided on Django, and I wrote a prototype using
> sqlite3.  Sqlite3 will not be used going forward.  Instead either Postgres
> or MySql will be used.  Personally I am in favor of Postgres, but I have
> been telling the group, perhaps incorrectly, that Django is "database
> agnostic" and that we can easily change databases at any time in the future
> should we need to do so.  So let me ask two more questions:
>
> In the life of a Django application, is it simple and easy to change the
> database flavor (say from Postgres to MySql), even after significant data
> has accumulated in the model's database?
>
> Does the answer change if we are willing to forgo the use of the
> version-control-like capabilities represented by Django's
> makemirations/migrate tools?
>
> Thanks.
>
>
>
>
>
>
>
>
>
>
>
>
>
>>
>>
>>
>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/458baa37-5387-4784-97c2-c7cbb50fc480%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/458baa37-5387-4784-97c2-c7cbb50fc480%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2By5TLY7v65oBPbsjW17ByqW4%3DGJTE359zo%3DqsGdEZKsEHm_uQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sqlite3 to Postgres Migration?

2015-02-20 Thread talex
Thanks for your helpful comments.

Andrew, thanks for your migration article at http://afrg.co/updj17/a2 .  It 
is slightly daunting for me at this point, but I may need to come back to 
it later. Your book looks interesting.

Mike, thanks for the dump/load load suggestion.

For the moment, I think the easiest thing for me is to follow Thomas, and 
just start over with Postgres, but let me explain more about what I am 
doing and ask two more questions.

I am leading a project to create a web application for uploading certain 
scientific data into a database.  No one in the group has experience with 
web development.  We decided on Django, and I wrote a prototype using 
sqlite3.  Sqlite3 will not be used going forward.  Instead either Postgres 
or MySql will be used.  Personally I am in favor of Postgres, but I have 
been telling the group, perhaps incorrectly, that Django is "database 
agnostic" and that we can easily change databases at any time in the future 
should we need to do so.  So let me ask two more questions:

In the life of a Django application, is it simple and easy to change the 
database flavor (say from Postgres to MySql), even after significant data 
has accumulated in the model's database?  

Does the answer change if we are willing to forgo the use of the 
version-control-like capabilities represented by Django's 
makemirations/migrate tools?

Thanks.













>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/458baa37-5387-4784-97c2-c7cbb50fc480%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sqlite3 to Postgres Migration?

2015-02-19 Thread Mike Dewhirst

On 20/02/2015 3:07 AM, Tom Lockhart wrote:

On Feb 18, 2015, at 11:04 PM, talex  wrote:


I have a functioning Django application that is based on sqlite3,
but I want to change to using Postgres.


I’ll point out for the benefit of others who might be getting started: 
Postgres is a full featured database and supports the full range of Django 
features and add-ons including GeoDjango. Starting development with a 
production-quality database already in place is not much more work and will 
save grief later on.

Usually I’d end with “hth†, but this is no help at all for talex…

- Tom



I agree with Tom.

You are looking for a pair of dump/load scripts. Check this post ...

http://stackoverflow.com/questions/4581727/convert-sqlite-sql-dump-file-to-postgresql

I haven't studied that SO post but at first glance it seems the sqlite 
dump file might be directly usable by postgres. If so, you need to 
create the new database in Postgres and load it from the sqlite dump file.


You need to look at the Postgres docs for psql which will load the 
sqlite3 data dump.


Here is an example I use regularly ...

psql --port=5432 --file=/home/mike/dumps/pg/ssds/pq3.dump --dbname=ssds 
--username=miked


hth

Mike

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/54E6740B.6070902%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble changing from sqlite3 to postgres

2015-02-19 Thread Collin Anderson
Hi,

It seems strange that it would be trying to convert a "date" column to an 
integer.

Since you're creating a new database from scratch, you could try deleting 
your migrations and generating them from scratch to see if that helps.

Otherwise, what does your "app_1.0003_auto_20141126_2333" file have for 
operations?

Collin

On Tuesday, February 17, 2015 at 9:22:30 PM UTC-5, tony@gmail.com wrote:
>
> The error occurs during migration.
> The following shows the complete traceback.
> Thanks.
> 
> % python manage migrate
> WFK: BASE_DIR= /home/bill/django/wfkprojs/proj1
> WFK: STATIC_PATH= /home/bill/django/wfkprojs/proj1/app_1/static/
> WFK: MEDIA_ROOT= /home/bill/django/wfkprojs/proj1/app_1/media_root/
> WFK: MEDIA_URL= /media_root/
> Operations to perform:
>   Apply all migrations: contenttypes, app_1, sessions, auth, admin
> Running migrations:
>   Applying app_1.0003_auto_20141126_2333...Traceback (most recent call 
> last):
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
> 65, in execute
> return self.cursor.execute(sql, params)
> psycopg2.ProgrammingError: column "date" cannot be cast automatically to 
> type integer
> HINT:  Specify a USING expression to perform the conversion.
>
>
> The above exception was the direct cause of the following exception:
>
> Traceback (most recent call last):
>   File "manage.py", line 10, in 
> execute_from_command_line(sys.argv)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/core/management/__init__.py", 
> line 385, in execute_from_command_line
> utility.execute()
>   File 
> "/usr/local/lib/python3.3/site-packages/django/core/management/__init__.py", 
> line 377, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/core/management/base.py", 
> line 288, in run_from_argv
> self.execute(*args, **options.__dict__)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/core/management/base.py", 
> line 338, in execute
> output = self.handle(*args, **options)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/core/management/commands/migrate.py",
>  
> line 160, in handle
> executor.migrate(targets, plan, fake=options.get("fake", False))
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/migrations/executor.py", 
> line 63, in migrate
> self.apply_migration(migration, fake=fake)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/migrations/executor.py", 
> line 97, in apply_migration
> migration.apply(project_state, schema_editor)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/migrations/migration.py", 
> line 107, in apply
> operation.database_forwards(self.app_label, schema_editor, 
> project_state, new_state)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/migrations/operations/fields.py",
>  
> line 139, in database_forwards
> schema_editor.alter_field(from_model, from_field, to_field)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/backends/schema.py", line 
> 473, in alter_field
> self._alter_field(model, old_field, new_field, old_type, new_type, 
> old_db_params, new_db_params, strict)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/backends/schema.py", line 
> 626, in _alter_field
> params,
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/backends/schema.py", line 
> 99, in execute
> cursor.execute(sql, params)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
> 81, in execute
> return super(CursorDebugWrapper, self).execute(sql, params)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
> 65, in execute
> return self.cursor.execute(sql, params)
>   File "/usr/local/lib/python3.3/site-packages/django/db/utils.py", line 
> 94, in __exit__
> six.reraise(dj_exc_type, dj_exc_value, traceback)
>   File "/usr/local/lib/python3.3/site-packages/django/utils/six.py", line 
> 549, in reraise
> raise value.with_traceback(tb)
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
> 65, in execute
> return self.cursor.execute(sql, params)
> django.db.utils.ProgrammingError: column "date" cannot be cast 
> automatically to type integer
> HINT:  Specify a USING expression to perfor

Re: Sqlite3 to Postgres Migration?

2015-02-19 Thread Tom Lockhart
On Feb 18, 2015, at 11:04 PM, talex  wrote:

> I have a functioning Django application that is based on sqlite3, 
> but I want to change to using Postgres.

I’ll point out for the benefit of others who might be getting started: Postgres 
is a full featured database and supports the full range of Django features and 
add-ons including GeoDjango. Starting development with a production-quality 
database already in place is not much more work and will save grief later on.

Usually I’d end with “hth”, but this is no help at all for talex…

- Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/9963605E-7243-4827-AD56-10544AB28634%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sqlite3 to Postgres Migration?

2015-02-19 Thread Andrew Pinkham
On Feb 19, 2015, at 1:04 AM, talex  wrote:
> Am I correct that use of "python makemigrations" followed by
> "python migrate", should copy the existing data into Postgres
> and leave me with a working application?

I'm afraid not.

Migration allows for predictable and reversible alterations to the database 
structure. It's an excellent tool for modifying the schema (tables, columns) of 
a database. It is possible to use migrations for data (rows), but you typically 
need to modify the migration to achieve your goal.

Migrations are not intended for moving data from one database to another. You 
might be able to use Django to help achieve your goal, but it's not magic. To 
start with, you will need both both databases to be connected to your Django 
site - if you disconnect your SQLite database, then all the data in it is 
unavailable to you. Django won't know how to get to it anymore.

You might find my article about migrations interesting:
http://afrg.co/updj17/a2

> Instead what is happening is that "python migrate" gives
> the following error and hint:
> 
>  django.db.utils.ProgrammingError: column "date" cannot be cast automatically 
> to type integer
>  HINT:  Specify a USING expression to perform the conversion.
> 
> How can I apply this hint to make this work?

I'm unfamiliar with this error, but I suspect your problem lies in the 
migration files. What files exist in `/app_name/migrations/` ? Those are the 
files that `./manage.py migrate` execute with.

Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5DE5783C-4AA5-4884-B369-DFA1F305A81D%40andrewsforge.com.
For more options, visit https://groups.google.com/d/optout.


Sqlite3 to Postgres Migration?

2015-02-18 Thread talex
I have a functioning Django application that is based on sqlite3, 
but I want to change to using Postgres.
I have altered the DATABASES clause in settings.py to use Postgres.
and I am using Django version 1.7.

Am I correct that use of "python makemigrations" followed by
"python migrate", should copy the existing data into Postgres
and leave me with a working application?

Instead what is happening is that "python migrate" gives
the following error and hint:

  django.db.utils.ProgrammingError: column "date" cannot be cast 
automatically to type integer
  HINT:  Specify a USING expression to perform the conversion.

How can I apply this hint to make this work?

My models.py file is as follows:

from django.db import models
import datetime

# Create your models here.

class Location(models.Model):

   class Meta:
  unique_together = ("lat", "lng")

   lat  = models.DecimalField(max_digits=8, decimal_places=5)
   lng  = models.DecimalField(max_digits=8, decimal_places=5)
   name = models.CharField(max_length=200,  unique=True)

   def __str__(self):
  return "%s: %d %d" % (self.name, self.lat, self.lng)

class Observation(models.Model):

   date = models.DateField()
   location = models.ForeignKey(Location)
   observer = models.CharField(max_length=50)
   temperature = models.FloatField(default=0.0)
   photo= models.ImageField(default="tower.jpg", 
upload_to="uploaded_photos")

   def __str__(self):
  return self.observer
---

Thanks.






-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/82208bed-4d02-49b5-83b2-f6302fa889b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble changing from sqlite3 to postgres

2015-02-17 Thread tony . guil35
The error occurs during migration.
The following shows the complete traceback.
Thanks.

% python manage migrate
WFK: BASE_DIR= /home/bill/django/wfkprojs/proj1
WFK: STATIC_PATH= /home/bill/django/wfkprojs/proj1/app_1/static/
WFK: MEDIA_ROOT= /home/bill/django/wfkprojs/proj1/app_1/media_root/
WFK: MEDIA_URL= /media_root/
Operations to perform:
  Apply all migrations: contenttypes, app_1, sessions, auth, admin
Running migrations:
  Applying app_1.0003_auto_20141126_2333...Traceback (most recent call 
last):
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
65, in execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: column "date" cannot be cast automatically to 
type integer
HINT:  Specify a USING expression to perform the conversion.


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 10, in 
execute_from_command_line(sys.argv)
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/__init__.py", 
line 385, in execute_from_command_line
utility.execute()
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/__init__.py", 
line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/base.py", 
line 288, in run_from_argv
self.execute(*args, **options.__dict__)
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/base.py", 
line 338, in execute
output = self.handle(*args, **options)
  File 
"/usr/local/lib/python3.3/site-packages/django/core/management/commands/migrate.py",
 
line 160, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
  File 
"/usr/local/lib/python3.3/site-packages/django/db/migrations/executor.py", 
line 63, in migrate
self.apply_migration(migration, fake=fake)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/migrations/executor.py", 
line 97, in apply_migration
migration.apply(project_state, schema_editor)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/migrations/migration.py", 
line 107, in apply
operation.database_forwards(self.app_label, schema_editor, 
project_state, new_state)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/migrations/operations/fields.py",
 
line 139, in database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/schema.py", line 
473, in alter_field
self._alter_field(model, old_field, new_field, old_type, new_type, 
old_db_params, new_db_params, strict)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/schema.py", line 
626, in _alter_field
params,
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/schema.py", line 
99, in execute
cursor.execute(sql, params)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
65, in execute
return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.3/site-packages/django/db/utils.py", line 
94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python3.3/site-packages/django/utils/six.py", line 
549, in reraise
raise value.with_traceback(tb)
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
65, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column "date" cannot be cast 
automatically to type integer
HINT:  Specify a USING expression to perform the conversion.


On Tuesday, February 17, 2015 at 4:39:27 PM UTC-8, Joel Burton wrote:
>
> The error is probably in code you wrote that uses the date field. Can you 
> post the full traceback? That will let us see where the caller was that 
> created the problem.
>
> On Tuesday, February 17, 2015 at 3:13:30 PM UTC-5, tony@gmail.com 
> wrote:
>>
>> I have written a simple Django app (my first) that works with sqlite3 
>> database.
>> I want to change to postgres, but when I run the Django 1.7 migration 
>> utility  with the command
>> "python manage.py migrate"
>>
>> I get the error:
>> psycopg2.ProgrammingError: column "date" cannot be cast automatically 
>> to type integer
>>
>> Which is occuring in:
>>   File 
>> "/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py"

Re: Trouble changing from sqlite3 to postgres

2015-02-17 Thread Joel Burton
The error is probably in code you wrote that uses the date field. Can you 
post the full traceback? That will let us see where the caller was that 
created the problem.

On Tuesday, February 17, 2015 at 3:13:30 PM UTC-5, tony@gmail.com wrote:
>
> I have written a simple Django app (my first) that works with sqlite3 
> database.
> I want to change to postgres, but when I run the Django 1.7 migration 
> utility  with the command
> "python manage.py migrate"
>
> I get the error:
> psycopg2.ProgrammingError: column "date" cannot be cast automatically 
> to type integer
>
> Which is occuring in:
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
> 65, in execute
> return self.cursor.execute(sql, params
>
> I am not sure how to track down the problem.
> I am running Slackware Linux.
>
> My models.py file is as follows:
>
> 
> from django.db import models
> import datetime
>
> # Create your models here.
>
> class Location(models.Model):
>
>class Meta:
>   unique_together = ("lat", "lng")
>
>lat  = models.DecimalField(max_digits=8, decimal_places=5)
>lng  = models.DecimalField(max_digits=8, decimal_places=5)
>name = models.CharField(max_length=200,  unique=True)
>
>def __str__(self):
>   return "%s: %d %d" % (self.name, self.lat, self.lng)
>
> class Observation(models.Model):
>
>date = models.DateField()
>location = models.ForeignKey(Location)
>observer = models.CharField(max_length=50)
>temperature = models.FloatField(default=0.0)
>photo= models.ImageField(default="tower.jpg", 
> upload_to="uploaded_photos")
>
>def __str__(self):
>   return self.observer
> =
>
> The DATABASE part of my settings.py file is as follows
> where I have commented-out the old sqlite3 part:
>
> -
> DATABASES = {
>
> #   'default': {
> #   # sqllite3
> #   'ENGINE': 'django.db.backends.sqlite3',
> #   'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
> #   }
>
># For postgres:
> #'django.db.backends.postgresql_psycopg2', 
> # USER, PASSWORD, HOST also needed
> # Inside postgres, "CREATE DATABASE database_name"
>
>  'default': {
>  'ENGINE': 'django.db.backends.postgresql_psycopg2',
>  'NAME': 'app_1_db',
>  'USER': 'bill',
>  'PASSWORD': 'bill',
>  'HOST': '127.0.0.1',
>  'PORT': '5432',
>  }
>
> }
>
> 
>
> Please let me know if you have ideas.
>
> Thanks.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/df155cf9-9ba7-42fd-b9b2-2a78f433ca21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Trouble changing from sqlite3 to postgres

2015-02-17 Thread tony . guil35
I have written a simple Django app (my first) that works with sqlite3 
database.
I want to change to postgres, but when I run the Django 1.7 migration 
utility  with the command
"python manage.py migrate"

I get the error:
psycopg2.ProgrammingError: column "date" cannot be cast automatically 
to type integer

Which is occuring in:
  File 
"/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
65, in execute
return self.cursor.execute(sql, params

I am not sure how to track down the problem.
I am running Slackware Linux.

My models.py file is as follows:


from django.db import models
import datetime

# Create your models here.

class Location(models.Model):

   class Meta:
  unique_together = ("lat", "lng")

   lat  = models.DecimalField(max_digits=8, decimal_places=5)
   lng  = models.DecimalField(max_digits=8, decimal_places=5)
   name = models.CharField(max_length=200,  unique=True)

   def __str__(self):
  return "%s: %d %d" % (self.name, self.lat, self.lng)

class Observation(models.Model):

   date = models.DateField()
   location = models.ForeignKey(Location)
   observer = models.CharField(max_length=50)
   temperature = models.FloatField(default=0.0)
   photo= models.ImageField(default="tower.jpg", 
upload_to="uploaded_photos")

   def __str__(self):
  return self.observer
=

The DATABASE part of my settings.py file is as follows
where I have commented-out the old sqlite3 part:

-
DATABASES = {

#   'default': {
#   # sqllite3
#   'ENGINE': 'django.db.backends.sqlite3',
#   'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
#   }

   # For postgres:
#'django.db.backends.postgresql_psycopg2', 
# USER, PASSWORD, HOST also needed
# Inside postgres, "CREATE DATABASE database_name"

 'default': {
 'ENGINE': 'django.db.backends.postgresql_psycopg2',
 'NAME': 'app_1_db',
 'USER': 'bill',
 'PASSWORD': 'bill',
 'HOST': '127.0.0.1',
 'PORT': '5432',
 }

}


Please let me know if you have ideas.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b905e0f0-898b-4c6e-9141-a33987270476%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Installing south and using sqlite3's :memory: ruins total test suite time

2015-01-20 Thread Peter Bengtsson
It seems, for some reason settings.COMPRESS_ENABLED gets set to False when 
south is installed. 

On Tuesday, January 20, 2015 at 12:37:44 PM UTC-8, Peter Bengtsson wrote:
>
> I have a django project on django 1.6. It's using django-nose and it's 
> using sqlite3's :memory: trick:
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3',
> 'NAME': ':memory:',
> }
> }
>
> Before I added `south` to INSTALLED_APPS it would take about ~5 seconds to 
> run the 371 tests. 
>
> So I add `south` to INSTALLED_APPS (and make sure django_nose is mentioned 
> last) and I also set SOUTH_TESTS_MIGRATE=False (meaning I can put things in 
> the the 0001_initial.py files and it doesn't get executed).
>
> Now it takes ~50 seconds to run the whole test suite. That's 10x times 
> slower! :(
>
> I ran the tests with nose-timer and it basically seems every test now gets 
> a lot slower. You can compare 
> https://gist.github.com/peterbe/34c9b14028d63429491c with 
> https://gist.github.com/peterbe/9202c20edee964a370d3
>
>
> Anybody know what's causing South (1.0.2) to make everything so much 
> slower?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0ea1c01f-d887-427e-a2d4-f3b2cbb97b4c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Installing south and using sqlite3's :memory: ruins total test suite time

2015-01-20 Thread Peter Bengtsson
Quick update there,
I've figured out where the time is spent. Those ~45 seconds is caused by 
django_compressor calling out to `lessc` to convert .less files to .css. 

I'm now trying to figure out why having south in INSTALLED_APPS changes 
whether that gets run or not. It shouldn't run anything in runtime because 
I have `COMPRESS_OFFLINE = True` on and I run compress before running 
tests. 

On Tuesday, January 20, 2015 at 12:37:44 PM UTC-8, Peter Bengtsson wrote:
>
> I have a django project on django 1.6. It's using django-nose and it's 
> using sqlite3's :memory: trick:
>
> DATABASES = {
> 'default': {
> 'ENGINE': 'django.db.backends.sqlite3',
> 'NAME': ':memory:',
> }
> }
>
> Before I added `south` to INSTALLED_APPS it would take about ~5 seconds to 
> run the 371 tests. 
>
> So I add `south` to INSTALLED_APPS (and make sure django_nose is mentioned 
> last) and I also set SOUTH_TESTS_MIGRATE=False (meaning I can put things in 
> the the 0001_initial.py files and it doesn't get executed).
>
> Now it takes ~50 seconds to run the whole test suite. That's 10x times 
> slower! :(
>
> I ran the tests with nose-timer and it basically seems every test now gets 
> a lot slower. You can compare 
> https://gist.github.com/peterbe/34c9b14028d63429491c with 
> https://gist.github.com/peterbe/9202c20edee964a370d3
>
>
> Anybody know what's causing South (1.0.2) to make everything so much 
> slower?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c119985d-b914-4e6d-88c5-de7cf04a080c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Installing south and using sqlite3's :memory: ruins total test suite time

2015-01-20 Thread Peter Bengtsson
I have a django project on django 1.6. It's using django-nose and it's 
using sqlite3's :memory: trick:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}

Before I added `south` to INSTALLED_APPS it would take about ~5 seconds to 
run the 371 tests. 

So I add `south` to INSTALLED_APPS (and make sure django_nose is mentioned 
last) and I also set SOUTH_TESTS_MIGRATE=False (meaning I can put things in 
the the 0001_initial.py files and it doesn't get executed).

Now it takes ~50 seconds to run the whole test suite. That's 10x times 
slower! :(

I ran the tests with nose-timer and it basically seems every test now gets 
a lot slower. You can compare 
https://gist.github.com/peterbe/34c9b14028d63429491c with 
https://gist.github.com/peterbe/9202c20edee964a370d3


Anybody know what's causing South (1.0.2) to make everything so much slower?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8f13473b-5a24-4546-b42e-8d1ab81b864c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django - How to fix “the procedure entry point sqlite3_rtree_geometry_callback could not be located in the dynamic link library sqlite3.dll”

2014-08-21 Thread Alex Lebedev
I got the same error message when I used django.contrib.gis on Windows 
(OSGeo4W). A python ctypes function tried to open wrong sqlite3.dll (wrong 
directory). That was the origin of issue. I reordered list of pathes in 
system environment variable "path" (replaced path to OSGeo4W/bin to the 
first place in the list) and renamed sqlite3.dll file in the python "DLLs" 
directory (to sqlite3.dll.bak).

среда, 20 августа 2014 г., 12:07:31 UTC+6 пользователь Shoaib Ijaz написал:
>
> I have problem with django project. I am facing error when i am trying to 
> execute project in browser.
>
> "the procedure entry point sqlite3_rtree_geometry_callback could not be 
> located in the dynamic link library sqlite3.dll"
>
> I have no idea where is the issue.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/25455d2c-a117-4933-a4b3-a8fce50fec81%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django - How to fix “the procedure entry point sqlite3_rtree_geometry_callback could not be located in the dynamic link library sqlite3.dll”

2014-08-19 Thread Shoaib Ijaz


I have problem with django project. I am facing error when i am trying to 
execute project in browser.

"the procedure entry point sqlite3_rtree_geometry_callback could not be 
located in the dynamic link library sqlite3.dll"

I have no idea where is the issue.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4d3473cc-f795-4ea6-959a-89c6d014ffdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: moving from sqlite3 to mysql

2014-02-06 Thread Malik Rumi
Ok, I got it working. And by working, I mean I got it to sync, I imported
the database.json into mysql, and when I runserver everything is there as
it should be.
So, many thanks to all my gracious and more senior django users for your
patient guidance and assistance.
A note to all newbies who may be following along and reading this days,
weeks, and years from now: Do yourself a favor and READ the documentation,
DON'T just scan it looking for a quick answer. You are bound to miss
something important.
Turns out that for all my struggling with a db name for mysql, all that
came after I had changed the settings.py to mysql. In other words, I didn't
think to go back and put the name I came up with, django_1, in settings.py.
But that was not enough. Now I had to also take off the
'--database=django_1' as that was unnecessary and maybe confusing django.
Once I did that, it all worked.

But don't worry, I'm sure I'll be back soon enough with some other
issues. :-)


On Wed, Feb 5, 2014 at 7:44 PM, Ariel E. Isidro  wrote:

> 1. before exiting mysql, you should grant permission to a user,i.e.
> grant all privileges on django_1.* to username@'localhost' identified by
> 'userpassword'
> replace username, userpassword with your own
> 2. exit mysql console
> 3. modify settings.py to add your username, password, host (localhost),
> and port (3306)
> 4. run python manage.py syncdb
>
>
> On Thu, Feb 6, 2014 at 7:52 AM, Drew Ferguson wrote:
>
>> Hi
>>
>> Just like SQLlite, you tell Django where the MySQL database is in
>> settings.py
>>
>> At the top you should have something like
>>
>> DATABASES = {
>>  'default': {
>>   'ENGINE': 'django.db.backends.mysql',
>>   'NAME': 'django_1', # Or path to database file if using sqlite3.
>> #  'USER': '',
>> #  'PASSWORD': '',
>> #  'HOST': '', # Empty for localhost
>> #  'PORT': '', # Set to empty string for default.
>>  }
>> }
>>
>>
>> On Wed, 5 Feb 2014 16:38:59 -0600
>> Malik Rumi  wrote:
>>
>> > mysql>  CREATE DATABASE django_1;
>> >
>> > Query OK, 1 row affected (0.24 sec)
>> >
>> > mysql> SHOW DATABASES;
>> >
>> > ++
>> >
>> > | Database   |
>> >
>> > ++
>> >
>> > | information_schema |
>> >
>> > | django_1   |
>> >
>> > | mysql  |
>> >
>> > | performance_schema |
>> >
>> > | test   |
>> >
>> > ++
>> >
>> > 5 rows in set (0.31 sec)
>> --
>> Drew Ferguson
>> AFC Commercial
>> http://www.afccommercial.co.uk
>>
>> --
>>
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/20140205235235.53a238b1%40blacktav.fergiesontour.org
>> .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>
>
> --
> *Ariel E. Isidro*
> Backup your important files, click here  <http://db.tt/7cLLR7V/>
>
> DISCLAIMER: This message is for the designated recipient only and may
> contain confidential and/or privileged information. If you have received it
> in error, please delete it and advise the sender immediately. You should
> not copy or use it for any other purpose, nor disclose its contents to any
> other person.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/django-users/zpNqaA2Fji8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAECOjiaW4jswaift33tcdTJc5DBwFYJhRKyZPmhn7FToC8QUvw%40mail.gmail.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKd6oBxrfndqFf0t7vOsXrnTzWP5_UMYbeZr3RYvdri2jSu%3Dug%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: moving from sqlite3 to mysql

2014-02-05 Thread Ariel E. Isidro
1. before exiting mysql, you should grant permission to a user,i.e.
grant all privileges on django_1.* to username@'localhost' identified by
'userpassword'
replace username, userpassword with your own
2. exit mysql console
3. modify settings.py to add your username, password, host (localhost), and
port (3306)
4. run python manage.py syncdb


On Thu, Feb 6, 2014 at 7:52 AM, Drew Ferguson wrote:

> Hi
>
> Just like SQLlite, you tell Django where the MySQL database is in
> settings.py
>
> At the top you should have something like
>
> DATABASES = {
>  'default': {
>   'ENGINE': 'django.db.backends.mysql',
>   'NAME': 'django_1', # Or path to database file if using sqlite3.
> #  'USER': '',
> #  'PASSWORD': '',
> #  'HOST': '', # Empty for localhost
> #  'PORT': '', # Set to empty string for default.
>  }
> }
>
>
> On Wed, 5 Feb 2014 16:38:59 -0600
> Malik Rumi  wrote:
>
> > mysql>  CREATE DATABASE django_1;
> >
> > Query OK, 1 row affected (0.24 sec)
> >
> > mysql> SHOW DATABASES;
> >
> > ++
> >
> > | Database   |
> >
> > ++
> >
> > | information_schema |
> >
> > | django_1   |
> >
> > | mysql  |
> >
> > | performance_schema |
> >
> > | test   |
> >
> > ++
> >
> > 5 rows in set (0.31 sec)
> --
> Drew Ferguson
> AFC Commercial
> http://www.afccommercial.co.uk
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/20140205235235.53a238b1%40blacktav.fergiesontour.org
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
*Ariel E. Isidro*
Backup your important files, click here  <http://db.tt/7cLLR7V/>

DISCLAIMER: This message is for the designated recipient only and may
contain confidential and/or privileged information. If you have received it
in error, please delete it and advise the sender immediately. You should
not copy or use it for any other purpose, nor disclose its contents to any
other person.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAECOjiaW4jswaift33tcdTJc5DBwFYJhRKyZPmhn7FToC8QUvw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: moving from sqlite3 to mysql

2014-02-05 Thread Drew Ferguson
Hi

Just like SQLlite, you tell Django where the MySQL database is in
settings.py

At the top you should have something like

DATABASES = {
 'default': {
  'ENGINE': 'django.db.backends.mysql', 
  'NAME': 'django_1', # Or path to database file if using sqlite3. 
#  'USER': '', 
#  'PASSWORD': '',
#  'HOST': '', # Empty for localhost
#  'PORT': '', # Set to empty string for default. 
 }
}


On Wed, 5 Feb 2014 16:38:59 -0600
Malik Rumi  wrote:

> mysql>  CREATE DATABASE django_1;
> 
> Query OK, 1 row affected (0.24 sec)
> 
> mysql> SHOW DATABASES;
> 
> ++
> 
> | Database   |
> 
> ++
> 
> | information_schema |
> 
> | django_1   |
> 
> | mysql  |
> 
> | performance_schema |
> 
> | test   |
> 
> ++
> 
> 5 rows in set (0.31 sec)
-- 
Drew Ferguson
AFC Commercial
http://www.afccommercial.co.uk

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/20140205235235.53a238b1%40blacktav.fergiesontour.org.
For more options, visit https://groups.google.com/groups/opt_out.


Re: moving from sqlite3 to mysql

2014-02-05 Thread Malik Rumi
mysql>  CREATE DATABASE django_1;

Query OK, 1 row affected (0.24 sec)

mysql> SHOW DATABASES;

++

| Database   |

++

| information_schema |

| django_1   |

| mysql  |

| performance_schema |

| test   |

++

5 rows in set (0.31 sec)

mysql> exit

Bye

python manage.py syncdb

Traceback (most recent call last):

(...)

File "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in
defaulterrorhandlerraise errorclass, errorvalue

django.db.utils.OperationalError: (1046, 'No database selected')

python manage.py syncdb django_1

CommandError: Command doesn't accept any arguments

python manage.py syncdb --django_1

Usage: manage.py syncdb [options]

Create the database tables for all apps in INSTALLED_APPS whose tables
haven't already been created.

manage.py: error: no such option: --django_1

<>

Ok, so MySQL wanted a db name, even though there was no db name (at least
not one I gave it) on sqlite3

when I ran syncdb without a name, it said no db selected

When I tried pointing it to a name, I got 'doesn't accept arguments' and
then 'no such option.'

Is django now saying this new database has to be listed as an installed
app? What am I missing here?

 - and thanks for much for your help.


On Tue, Jan 28, 2014 at 8:45 PM, Ariel E. Isidro  wrote:

> "Or can I create the database, (presumably directly in the shell), and
> then empty it, as these instructions say, and that will take care of it? I
> frankly didn't understand why I would need to 'empty' a new and empty
> database, but that's what it says. "
>
> With sql lite, everything will be created for you.
> While with MySQL,  you should create the database directly in the shell,
> and this should give you an empty database.  The Django tables will be
> created after configuring your settings, and running  syncdb.
>
>
>
>
> On Wed, Jan 29, 2014 at 1:17 AM, Malik Rumi wrote:
>
>> This is somewhat like the question in "need help moving to production
>> server" but I think the right procedure is to start a new thread. So I
>> think I have done well for just starting out. With your help I've gotten
>> Django running on Windows, and I completed a tutorial and got my site
>> working locally with the admin. thank you.
>>
>> So I thought I was ready to move up to MySQL for some heavy lifting. I
>> followed the instructions I got here
>> http://matthewwittering.com/blog/how-to-migrating-the-database-engine-for-django.html.
>> I did not know what to do with the NAME part, so I put in 'django-1', and
>> promptly got the error message 'unknown database 'django-1'. I thought that
>> made sense because I hadn't created this database in mysql already, but
>> I was just blindly following along. Having to CREATE DATABASE doesn't make
>> sense, I thought, because it defeats the purpose of Django abstraction in
>> the first place. Besides, when I syncdb, it should take whatever name I
>> gave it when I was using sqlite3, right?
>>
>> Wrong. When I ran syncdb, this time with NAME: ' ', I got :   File
>> "C:\Python27\lib\site-packages\MySQLdb\connections.py", line 36, in default
>> terror handlerraise errorclass, errorvalue
>> django.db.utils.OperationalError: (1046, 'No database selected').
>>
>> So, what am I missing here? There almost certainly is an easy solution
>> I'm not seeing. Do I need to create a database in mysql? If so, must it
>> have the same name as it had in sqlite3? I know that name was made from
>> putting the model name together with something else, but I don't actually
>> remember what it was, and it seems like a lot of extra work to install an
>> sqlite browser just to get that name right. If that's what I need to do,
>> maybe I can just open that file with notepad?
>>
>> Or can I create the database, (presumably directly in the shell), and
>> then empty it, as these instructions say, and that will take care of it? I
>> frankly didn't understand why I would need to 'empty' a new and empty
>> database, but that's what it says.
>>
>> Any and all helpful advise welcome and appreciated.
>>
>>   --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>>
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit 

  1   2   3   4   >