Firebird - Schema migrations: add or alter field

2018-04-09 Thread Maximiliano Robaina
Hi folks,

I'm here again trying to up to date the django-firebird backend.
The last stable version was for django 1.8 LTS, that came to end of life, 
so I want to update to 1.11 LTS first  and then to 2.0.

Having said that, one of unresolved things is about  adding a non-nullable 
field to a populated table, in this case Firebird seems to work differently 
than others sql engines. 
If I have to update data over a recently added field (actually django does 
this adding a default value and removing this afterward), I need commit the 
alter table command first then, populate the new field with the provide 
default value. [1]
Firebird doesn't allow updates/inserts to use objects created in the same 
transaction (in this case the column) because DDL is actually only really 
executed/completed at transaction commit.

Then, What do you think is the best approach to achieve this?
Is necessary to rewrite the context maneger interface of 
BaseDatabaseSchemaEditor?
Maybe a new hook to run command after the metadata update finish?

Regards.


[1] Here there's a discussion about this
https://groups.yahoo.com/neo/groups/firebird-support/conversations/topics/130739

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/4752f38a-d821-4a17-90a3-bb6d2621cc72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Shouldn't manage.py call python3 instead of python?

2018-04-09 Thread Collin Anderson
I personally just edit my manage.py to change it from python to python3.
Maybe we could just document that?

(Or would it work to use os.path.basename(sys.executable) ?)

On Sun, Apr 8, 2018 at 11:02 AM, Tom Forbes  wrote:

> It may be an obstacle but I believe it’s better than having them nuke
> their base systems by accident by installing a package that conflicts with
> their base system. This isn’t such a huge issue on MacOS but on Linux it is
> and I’ve seen it happen a few times. Not to mention the issue of multiple
> conflicting dependencies across projects - all in all it’s really not a
> recommended and we should not look to make it easier IMO.
>
> People have different setups and whatever works, works, but things like
> pipenv are maturing rapidly and solve the convenience issue you describe.
> I personally use virtualenvwrapper which is really simple to set up and
> displays the current virtual environment in the prompt, and makes it really
> easy to switch between them/create new ones.
>
> Tom
>
>
>
> On 8 April 2018 at 15:00:46, Bobby Mozumder (bmozum...@gmail.com) wrote:
>
> I never really liked the idea of using VirtualEnv or HomeBrew over the
> default installation in Mac OS.  (FreeBSD has the same naming issues).
>
> Having beginners use VirtualEnv or HomeBrew always struck me as a huge
> obstacle to getting a beginners Django developer's environment operational,
> as well as being a huge pain-in-the-ass of always setting VirtualEnvs for
> each shell.  So, I personally don’t use them anymore, and just use the base
> system now.
>
> I wish there was a process of running Django out-of-the-box from a default
> Mac OS install.
>
> -bobby
>
> On Apr 8, 2018, at 8:27 AM, Tom Forbes  wrote:
>
> This only seems to be an issue when you are using the base system
> interpreter to run manage.py. installing Django and other dependencies
> there is not recommended for a variety of reasons, and this isn't a problem
> when using a virtualenv, it doesn't seem like there is much to fix IMO.
>
>
> On Sun, 8 Apr 2018, 08:19 Bobby Mozumder,  wrote:
>
>> Is it OK to reopen that ticket?
>>
>> The problem is that python2 and python3 need to coexist in most systems,
>> and you can’t just rename python3 to python.
>>
>> -bobby
>>
>> On Apr 6, 2018, at 8:30 PM, Tim Graham  wrote:
>>
>> It was tried in https://code.djangoproject.com/ticket/27878 but it
>> caused problems, particularly on Windows.
>>
>> On Friday, April 6, 2018 at 6:35:50 PM UTC-4, Josh Smeaton wrote:
>>>
>>> I think you're right and PEP394 is the relevant text:
>>> https://www.python.org/dev/peps/pep-0394/
>>>
>>> TL;DR
>>>
>>> For now, *python* should refer to python2 and *python3* should be used
>>> to refer to python 3.
>>>
>>> On Saturday, 7 April 2018 07:07:35 UTC+10, Bobby Mozumder wrote:

 The header of manage.py has: #!/usr/bin/env python

 Shoudn’t it be: #!/usr/bin/env python3

 Since 2.0 is now only Python3. Both my Mac OS & FreeBSD environments
 have Python 3.5+ as “python3". (I’m not sure about Linux or other
 environments).

 Is that a bug I need to file?

 -bobby

>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-developers@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-developers.
>> To view this discussion on the web visit https://groups.google.
>> com/d/msgid/django-developers/7cdf48bb-ab0b-449d-8f33-
>> a4c6d369%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 developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-developers@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-developers.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-developers/E1881F92-2D8C-45D8-8315-E5D72D0D7B6E%40gmail.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-de

Re: Shouldn't manage.py call python3 instead of python?

2018-04-09 Thread Adam Johnson
>
> (Or would it work to use os.path.basename(sys.executable) ?)


The shebang is interpreted by the OS so this is before python even starts :)

On 9 April 2018 at 20:53, Collin Anderson  wrote:

> I personally just edit my manage.py to change it from python to python3.
> Maybe we could just document that?
>
> (Or would it work to use os.path.basename(sys.executable) ?)
>
> On Sun, Apr 8, 2018 at 11:02 AM, Tom Forbes  wrote:
>
>> It may be an obstacle but I believe it’s better than having them nuke
>> their base systems by accident by installing a package that conflicts with
>> their base system. This isn’t such a huge issue on MacOS but on Linux it is
>> and I’ve seen it happen a few times. Not to mention the issue of multiple
>> conflicting dependencies across projects - all in all it’s really not a
>> recommended and we should not look to make it easier IMO.
>>
>> People have different setups and whatever works, works, but things like
>> pipenv are maturing rapidly and solve the convenience issue you
>> describe. I personally use virtualenvwrapper which is really simple to
>> set up and displays the current virtual environment in the prompt, and
>> makes it really easy to switch between them/create new ones.
>>
>> Tom
>>
>>
>>
>> On 8 April 2018 at 15:00:46, Bobby Mozumder (bmozum...@gmail.com) wrote:
>>
>> I never really liked the idea of using VirtualEnv or HomeBrew over the
>> default installation in Mac OS.  (FreeBSD has the same naming issues).
>>
>> Having beginners use VirtualEnv or HomeBrew always struck me as a huge
>> obstacle to getting a beginners Django developer's environment operational,
>> as well as being a huge pain-in-the-ass of always setting VirtualEnvs for
>> each shell.  So, I personally don’t use them anymore, and just use the base
>> system now.
>>
>> I wish there was a process of running Django out-of-the-box from a
>> default Mac OS install.
>>
>> -bobby
>>
>> On Apr 8, 2018, at 8:27 AM, Tom Forbes  wrote:
>>
>> This only seems to be an issue when you are using the base system
>> interpreter to run manage.py. installing Django and other dependencies
>> there is not recommended for a variety of reasons, and this isn't a problem
>> when using a virtualenv, it doesn't seem like there is much to fix IMO.
>>
>>
>> On Sun, 8 Apr 2018, 08:19 Bobby Mozumder,  wrote:
>>
>>> Is it OK to reopen that ticket?
>>>
>>> The problem is that python2 and python3 need to coexist in most systems,
>>> and you can’t just rename python3 to python.
>>>
>>> -bobby
>>>
>>> On Apr 6, 2018, at 8:30 PM, Tim Graham  wrote:
>>>
>>> It was tried in https://code.djangoproject.com/ticket/27878 but it
>>> caused problems, particularly on Windows.
>>>
>>> On Friday, April 6, 2018 at 6:35:50 PM UTC-4, Josh Smeaton wrote:

 I think you're right and PEP394 is the relevant text:
 https://www.python.org/dev/peps/pep-0394/

 TL;DR

 For now, *python* should refer to python2 and *python3* should be used
 to refer to python 3.

 On Saturday, 7 April 2018 07:07:35 UTC+10, Bobby Mozumder wrote:
>
> The header of manage.py has: #!/usr/bin/env python
>
> Shoudn’t it be: #!/usr/bin/env python3
>
> Since 2.0 is now only Python3. Both my Mac OS & FreeBSD environments
> have Python 3.5+ as “python3". (I’m not sure about Linux or other
> environments).
>
> Is that a bug I need to file?
>
> -bobby
>

>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django developers (Contributions to Django itself)" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-developers+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-developers@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-developers.
>>> To view this discussion on the web visit https://groups.google.co
>>> m/d/msgid/django-developers/7cdf48bb-ab0b-449d-8f33-a4c6d777
>>> 7369%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 developers (Contributions to Django itself)" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-developers+unsubscr...@googlegroups.com.
>>> To post to this group, send email to django-developers@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-developers.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/django-developers/E1881F92-2D8C-45D8-8315-E5D72D0D7B6E%40gmail.com
>>> 

Returning exit code 1 from 'showmigrations' when there are unapplied migrations

2018-04-09 Thread Paweł Adamczak
Hi,

We've been talking about it internally in my company and wanted to ask 
about feedback for adding an --exit / --check option (similarly 
to 
https://groups.google.com/forum/#!searchin/django-developers/exit$20code|sort:date/django-developers/I3M6B-wYYd8/5sZY30VtlR4J)
 
for showmigrations command that would return status code 1 when there are 
unapplied migrations.
This seems to be a semi-popular question on StackOverflow 
(https://stackoverflow.com/questions/31838882/check-for-pending-django-migrations)
 
and except for the proposed grep, there seem to be no other solutions.

I'd be happy to do the necessary work if you think it's a good idea.

All best,
Pawel

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/45653b55-8fcf-4058-becd-8f74198c054a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Shouldn't manage.py call python3 instead of python?

2018-04-09 Thread Collin Anderson
I'm thinking something like #!/usr/bin/env
{{ os.path.basename(sys.executable) }} when running startproject. (Though
on windows I that would be #!/usr/bin/env python.exe - not sure if that
would work or not)

On Mon, Apr 9, 2018 at 3:58 PM, Adam Johnson  wrote:

> (Or would it work to use os.path.basename(sys.executable) ?)
>
>
> The shebang is interpreted by the OS so this is before python even starts
> :)
>
> On 9 April 2018 at 20:53, Collin Anderson  wrote:
>
>> I personally just edit my manage.py to change it from python to python3.
>> Maybe we could just document that?
>>
>> (Or would it work to use os.path.basename(sys.executable) ?)
>>
>> On Sun, Apr 8, 2018 at 11:02 AM, Tom Forbes  wrote:
>>
>>> It may be an obstacle but I believe it’s better than having them nuke
>>> their base systems by accident by installing a package that conflicts with
>>> their base system. This isn’t such a huge issue on MacOS but on Linux it is
>>> and I’ve seen it happen a few times. Not to mention the issue of multiple
>>> conflicting dependencies across projects - all in all it’s really not a
>>> recommended and we should not look to make it easier IMO.
>>>
>>> People have different setups and whatever works, works, but things like
>>> pipenv are maturing rapidly and solve the convenience issue you
>>> describe. I personally use virtualenvwrapper which is really simple to
>>> set up and displays the current virtual environment in the prompt, and
>>> makes it really easy to switch between them/create new ones.
>>>
>>> Tom
>>>
>>>
>>>
>>> On 8 April 2018 at 15:00:46, Bobby Mozumder (bmozum...@gmail.com) wrote:
>>>
>>> I never really liked the idea of using VirtualEnv or HomeBrew over the
>>> default installation in Mac OS.  (FreeBSD has the same naming issues).
>>>
>>> Having beginners use VirtualEnv or HomeBrew always struck me as a huge
>>> obstacle to getting a beginners Django developer's environment operational,
>>> as well as being a huge pain-in-the-ass of always setting VirtualEnvs for
>>> each shell.  So, I personally don’t use them anymore, and just use the base
>>> system now.
>>>
>>> I wish there was a process of running Django out-of-the-box from a
>>> default Mac OS install.
>>>
>>> -bobby
>>>
>>> On Apr 8, 2018, at 8:27 AM, Tom Forbes  wrote:
>>>
>>> This only seems to be an issue when you are using the base system
>>> interpreter to run manage.py. installing Django and other dependencies
>>> there is not recommended for a variety of reasons, and this isn't a problem
>>> when using a virtualenv, it doesn't seem like there is much to fix IMO.
>>>
>>>
>>> On Sun, 8 Apr 2018, 08:19 Bobby Mozumder,  wrote:
>>>
 Is it OK to reopen that ticket?

 The problem is that python2 and python3 need to coexist in most
 systems, and you can’t just rename python3 to python.

 -bobby

 On Apr 6, 2018, at 8:30 PM, Tim Graham  wrote:

 It was tried in https://code.djangoproject.com/ticket/27878 but it
 caused problems, particularly on Windows.

 On Friday, April 6, 2018 at 6:35:50 PM UTC-4, Josh Smeaton wrote:
>
> I think you're right and PEP394 is the relevant text:
> https://www.python.org/dev/peps/pep-0394/
>
> TL;DR
>
> For now, *python* should refer to python2 and *python3* should be
> used to refer to python 3.
>
> On Saturday, 7 April 2018 07:07:35 UTC+10, Bobby Mozumder wrote:
>>
>> The header of manage.py has: #!/usr/bin/env python
>>
>> Shoudn’t it be: #!/usr/bin/env python3
>>
>> Since 2.0 is now only Python3. Both my Mac OS & FreeBSD environments
>> have Python 3.5+ as “python3". (I’m not sure about Linux or other
>> environments).
>>
>> Is that a bug I need to file?
>>
>> -bobby
>>
>
 --
 You received this message because you are subscribed to the Google
 Groups "Django developers (Contributions to Django itself)" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-developers+unsubscr...@googlegroups.com.
 To post to this group, send email to django-developers@googlegroups.com
 .
 Visit this group at https://groups.google.com/group/django-developers.
 To view this discussion on the web visit https://groups.google.co
 m/d/msgid/django-developers/7cdf48bb-ab0b-449d-8f33-a4c6d777
 7369%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 developers (Contributions to Django itself)" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-developers+unsubscr...@googlegroups.com.
 To post to this group, send email to django-developers