Re: Use CDN for djangoproject.com

2019-02-13 Thread Cristiano Coelho
Consider AWS's cloudfront then :) El martes, 12 de febrero de 2019, 2:34:09 (UTC-5), Florian Apolloner escribió: > > Especially cloudflare is a service we do not want to use. as for the docs > only, does the mirror on rtd work better for you? They are probably behind > a CDN. > > Cheers, >

Re: Extend FAQ with "How do I get Django and my JS framework to work together?"

2019-02-04 Thread Cristiano Coelho
Pointing to Django Rest Framework should be more than enough. Anyone starting a project with Django and a SPA/JS architecture, will pretty much end up with DRF. Correct me if I'm wrong. El lunes, 4 de febrero de 2019, 19:52:42 (UTC-5), Maciek Olko escribió: > > I didn't find this topic being

Re: A faster paginator for django

2018-12-21 Thread Cristiano Coelho
Let's not forget how the various *count *calls starts to kill your database when you get over 1 million rows (postgres at least). So far the only options I have found with postgres are: - Estimate count for non filtered queries: SELECT reltuples::BIGINT FROM pg_class WHERE relname = '%s'; - If

Re: Any reason to not use SHA256 (or newer) for Signer / TimeStampSigner classess?

2018-05-09 Thread Cristiano Coelho
ticket about it: https://code.djangoproject.com/ticket/27468 > > Backwards compatibility is the main consideration. > > On Tuesday, May 8, 2018 at 6:44:05 PM UTC-4, Cristiano Coelho wrote: >> >> Looks like the Signer class (and perhaps other parts of the code) still >>

Any reason to not use SHA256 (or newer) for Signer / TimeStampSigner classess?

2018-05-08 Thread Cristiano Coelho
Looks like the Signer class (and perhaps other parts of the code) still use SHA1 ([1] and [2]) for the HMAC signing/hashing process. I'm wondering if there's any specific reason to use SHA1 over newer versions, or if it would be worth it to pass the hash algorithm as a variable or even config

Re: Add Alias or annotations without group-by support?

2018-03-10 Thread Cristiano Coelho
I think we already have the building blocks we need to avoid adding > another queryset method. > > On Saturday, 10 March 2018 14:01:41 UTC+11, Cristiano Coelho wrote: >> >> It wouldn't work if you also want to order by the annotated value. >> >> El viernes, 9 de marzo de 20

Re: Add Alias or annotations without group-by support?

2018-03-09 Thread Cristiano Coelho
most other queryset methods have support for > expressions now (order_by, values/values_list). > > For the alias used multiple times case, it should be enough to annotate > and then restrict with values if you don't actually want it in the > select/group list. > > On Friday

Re: Add Alias or annotations without group-by support?

2018-03-08 Thread Cristiano Coelho
-3), Jared Proffitt escribió: > > I have also run into this exact problem. Would love to get this fixed. > Have you found a good workaround? > > On Tuesday, December 26, 2017 at 12:37:16 PM UTC-6, Cristiano Coelho wrote: >> >> Hello, I'm having a hard time explaining the

Add Alias or annotations without group-by support?

2017-12-26 Thread Cristiano Coelho
Hello, I'm having a hard time explaining the exact issue but I hope it's clear enough. Following this issue (https://groups.google.com/forum/#!searchin/django-users/cristiano%7Csort:date/django-users/q6XdfyK29HA/TcE8oFitBQAJ) from django users and a related ticket

Re: Should django File wrapper support .next()?

2017-08-16 Thread Cristiano Coelho
alling iter() on > them first, it's Python 3 compatible too. > > On 27 July 2017 at 17:24, Cristiano Coelho <cristia...@gmail.com > > wrote: > >> Hello, >> >> I have recently found an interesting issue, using a project that relies >> on different sto

Re: Automatic prefetching in querysets

2017-08-15 Thread Cristiano Coelho
I would rather have warnings as well, adding more magical behavior is bad and might even degrade performance on some cases, automatically selecting a bunch of data that "might" be used is bad, and specially considering how slow python is, accidentally loading/building 1k+ objects when maybe

Should django File wrapper support .next()?

2017-07-27 Thread Cristiano Coelho
Hello, I have recently found an interesting issue, using a project that relies on different storage backends, when switching from a custom one to django's file system storage, I found that existing code that would iterate files with the next() call would start to fail, since although django's

Re: Adding UNION/INTERSECT/EXCEPT to the ORM

2016-12-26 Thread Cristiano Coelho
Is this going to be different from the pipe ( | ) and and ( & ) operators on querysets? If I'm not wrong those can already result in a union query (but not necessary, sometimes it just returns a query with an or/and condition) El viernes, 23 de diciembre de 2016, 11:12:40 (UTC-3), Florian

Re: Implicit ForeignKey index and unique_together

2016-09-16 Thread Cristiano Coelho
I think that the issue on Trac is actually something different, it talks about the need (or not) of an index, when defining a unique constraint. Most databases (if not all) will create an index automatically when a unique constraint is defined, and correct me if I'm wrong, but PostgreSQL (I

Re: Logging config tries too hard

2016-09-10 Thread Cristiano Coelho
I had troubles understanding the logging setup the first time, but after that, its quite simple on every project. I usually end up copy/pasting some console and db logger class and just add it to the config, I don't really think it is that difficult El martes, 6 de septiembre de 2016, 9:57:16

Re: Possible Bug in RegexURLResolver

2016-07-14 Thread Cristiano Coelho
are built up in local variables, and then set in > self._namespace_dict[language_code] etc. as an atomic operation. The > worst that can happen is that the list is overwritten atomically with an > identical list. self._callback_strs is a set, so updating it with values > that are already

Re: Possible Bug in RegexURLResolver

2016-07-12 Thread Cristiano Coelho
me if I missed a reason for using something more > complicated. > > self._lock needs to be a RLock if _populate can call itself recursively in > a given thread. > > Best regards, > > -- > Aymeric. > > On 12 Jul 2016, at 03:20, Cristiano Coelho <cristia...@gm

Re: Possible Bug in RegexURLResolver

2016-07-11 Thread Cristiano Coelho
self._populating = True self.lock.release() ... self.lock.acquire() self._populating = False self.lock.notify_all() self.lock.release() El lunes, 11 de julio de 2016, 22:14:04 (UTC-3), Cristiano Coelho escribió: > > Wouldn't a standard Lock do the

Re: Possible Bug in RegexURLResolver

2016-07-11 Thread Cristiano Coelho
Wouldn't a standard Lock do the trick? Also you are still vulnerable to a race condition when reading self._populating, if the goal is to avoid populating the object more than once in a short interval (in a case where multiple requests hit the server before the object is initialized for the

Re: Admin-Actions also in the object details view

2016-07-11 Thread Cristiano Coelho
Thanks, I guess that can do it for now. It's a shame the one who started implementing this in django itself just abandoned it :( El lunes, 11 de julio de 2016, 8:55:17 (UTC-3), Alex Riina escribió: > > Here's an implementation: > > https://github.com/crccheck/django-object-actions > > Combining

Re: Admin-Actions also in the object details view

2016-07-10 Thread Cristiano Coelho
Sorry to bring this up (quite a few years old already) Are there any plans to bring this to life? The ticket seems to have died as well. It could be very useful to have actions re used on the detail view page somehow. Right now the only option is to override the template. -- You received this

Re: Adding a database-agnostic JSONField into Django

2016-06-24 Thread Cristiano Coelho
I would like it. I honestly one use JsonField to store json data, not really to query it, and having postgres store it a very efficient way is a very nice plus compared to plain text storage. Then the postgres features to query json data are godlike but I wouldn't mind trading something to

Re: Threads and db connection handling question

2016-06-03 Thread Cristiano Coelho
Aymeric, I have never said anything about connection pool, I'm talking about thread pooling to perform async work (without the need to spawn a new thread every time and have control over the amount data that is offloaded) and the behaviour of django connections when used on a separate thread

Re: Threads and db connection handling question

2016-06-03 Thread Cristiano Coelho
El viernes, 3 de junio de 2016, 4:41:16 (UTC-3), Florian Apolloner escribió: > > > Yes, SIGTERM is a signal Python should handle nicely, SIGKILL will just > nuke the process from earth and prevent any cleanup I think. Note that the > OS will clean up though (sooner or later). As for the open

Re: Threads and db connection handling question

2016-06-02 Thread Cristiano Coelho
Some of the pools might have some high load (such as the one that handles logging to the database and other sources) so opening and closing a connection for each call might end up bad. Now that you mention django code, does connection.close_if_unusable_or_obsolete() always close the

Re: Threads and db connection handling question

2016-06-02 Thread Cristiano Coelho
t; > def my_thread_start(): > with closing(connection): > # do normal work > > You can even create a quick decorator if that's too much modification. > > On Thu, Jun 2, 2016 at 5:48 PM, Cristiano Coelho <cristia...@gmail.com > > wrote: > >> Florian,

Re: Threads and db connection handling question

2016-06-02 Thread Cristiano Coelho
that being something being done in django at all. El jueves, 2 de junio de 2016, 19:32:15 (UTC-3), Florian Apolloner escribió: > > On Thursday, June 2, 2016 at 11:55:41 PM UTC+2, Cristiano Coelho wrote: >> >> Not always, for example, on amazon elastic beasntalk when you either

Re: Threads and db connection handling question

2016-06-02 Thread Cristiano Coelho
El jueves, 2 de junio de 2016, 11:48:33 (UTC-3), Florian Apolloner escribió: > > > No it would not be great at all, connections could theoretically shared > between threads etc… In general Django has no way of knowing when you want > to close it. In the end a "dying" thread* which is not

Re: Threads and db connection handling question

2016-06-02 Thread Cristiano Coelho
So what was stated on the stack overflow post that connections are somehow closed only at the end of a request through the request end signal is still the actual behavior? Any best / suggested practices on how to handle connections on threads that are not part of the request cycle? Considering

Re: Threads and db connection handling question

2016-06-01 Thread Cristiano Coelho
: > > Is there a good reason to do this with your own custom thread pool > management inside Django and (I'm assuming) WSGI? Celery is a well > understood solution to the problem of background tasks and has a really > nice API. > > On Wed, Jun 1, 2016 at 5:34 PM, Cristiano Coelho

Re: Threads and db connection handling question

2016-06-01 Thread Cristiano Coelho
Wednesday, June 1, 2016 at 6:34:05 PM UTC-4, Cristiano Coelho wrote: >> >> Let me start saying sorry if this actually belongs to django-users rather >> than developers. >> >> I'm curious about (and if someone can point me to the code) how exactly >> d

Threads and db connection handling question

2016-06-01 Thread Cristiano Coelho
Let me start saying sorry if this actually belongs to django-users rather than developers. I'm curious about (and if someone can point me to the code) how exactly django handles database connections (in particular when persistent connections are used). As I can tell from the docs, they are

Re: Tracking/logging bruteforcing, especially on admin accounts?

2016-05-19 Thread Cristiano Coelho
IP based throttling like django-rest-framework would be ideal! I know there are some 3rd party libraries that tries to add ip based throttling to django although not as cool as drf ones. El jueves, 19 de mayo de 2016, 8:11:27 (UTC-3), Vaibhav Mallya escribió: > > Hi everyone, > > I've been

Re: Table Locks and bulk creating inherited models

2016-05-03 Thread Cristiano Coelho
In my opinion SELECT ... FOR UPDATE is already quite powerful to add locks. Might not be as good as a straight table lock, but gives you enough power to lock by rows (select some indexed columns, most dbs will lock only rows matching them) or select by a non indexed column which will probably

Re: NumericListfilter or similar

2016-04-30 Thread Cristiano Coelho
Implementing a custom filter with an arbitrary text input is quite easy. All you need is a template and subclass of ListFilter. However I agree that it could be great that it comes already as an option by django since ListFilter and FieldFilter are usually not enough. -- You received this

Re: Enforcing a max size for form field values read into memory (review/determination of next steps needed)

2016-04-20 Thread Cristiano Coelho
Hi, In particular I'm interested in this new setting: DATA_UPLOAD_MAX_MEMORY_SIZE [1] that only seems to be checked against mutlparts [2] and url encoded[3] request bodies. It could be good that this setting is also checked against other types where request.body is read directly, as you can

Re: Enforcing a max size for form field values read into memory (review/determination of next steps needed)

2016-04-15 Thread Cristiano Coelho
I have a small concern. The two new settings looks like will work on uploaded files count (multipart encoding types) and number of fields sent (url encoded encoding). What happens to other request types such as JSON, XML, plain text etc... If you are using django-rest-framework, how would the

Re: MySQL data loss possibility with concurrent ManyToManyField saves

2016-03-21 Thread Cristiano Coelho
en by the DELETE, and hence > not > changed by it, and hence continues to be visible by the SELECTs in our > transaction. But when we commit, the row (which has been deleted) no > longer > exists. > > I have expressed elsewhere my opinion of this behavior as a general > d

Re: [GSoC 2016]Proposal: Validity check at client and dynamic form framework

2016-03-21 Thread Cristiano Coelho
or > eight weeks to finish it. > > Do you think I should focus on client side validation (delete dynamic form > part)? Or describe the complexity of dynamic form and give a more detailed > schedule? > > Thanks again! > > 在 2016年3月21日星期一 UTC+8上午2:23:16,Cristiano Coe

Re: FileField and ImageField

2016-03-20 Thread Cristiano Coelho
I have done some work here https://github.com/cristianocca/django/commit/4be936ba3031f95d34101a919648f4e8f7d7856a And opened a ticket here https://code.djangoproject.com/ticket/26382 If someone's willing to take a look. -- You received this message because you are subscribed to the Google

Re: MySQL data loss possibility with concurrent ManyToManyField saves

2016-03-20 Thread Cristiano Coelho
What performance changes can you expect doing this change? It is probably that default on MySQL for a good reason. -- 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

Re: [GSoC 2016]Proposal: Validity check at client and dynamic form framework

2016-03-20 Thread Cristiano Coelho
The client side validation is a very good idea, other frameworks such as ASP.NET MVC already has some basic client side validation tied to model fields (equivalent to django forms) and also provides a very easy way to add custom javascript validation and tie to the model/form. For the second

Re: FileField and ImageField

2016-03-20 Thread Cristiano Coelho
might already have the correct > methods needed for FileField to work. Fields should do all of their > path/storage IO via their storage object though. > > > On Thursday, 17 March 2016 12:16:00 UTC+11, Cristiano Coelho wrote: >> >> To add a bit more about

Re: FileField and ImageField

2016-03-19 Thread Cristiano Coelho
To add a bit more about this, it seems that FileField is really meant to be working with an OS file system, making it harder to use a custom Storage that sends data to somewhere like AWS S3 where basically everything is a file (there are no real folders, just key prefixes) These 3 functions

FileField and ImageField

2016-03-19 Thread Cristiano Coelho
I am recently trying to make an aws S3 storage (I know there are a few libraries in there but I needed some customization). The storage works fine so far! However, there are some implementation details on FileField and ImageField, in particular the function generate_filename

Re: MySQL data loss possibility with concurrent ManyToManyField saves

2016-03-14 Thread Cristiano Coelho
zo de 2016, 20:12:29 (UTC-3), Shai Berger escribió: > > Hi, > > I just commented on the ticket, but wanted to clarify a few things here: > > On Tuesday 15 March 2016 00:48:02 Cristiano Coelho wrote: > > The django-admin interface is quite bad at handling concurrent >

Re: MySQL data loss possibility with concurrent ManyToManyField saves

2016-03-14 Thread Cristiano Coelho
The django-admin interface is quite bad at handling concurrent modifications, this is one problem that might not happen on other backends and is quite critical, but other issues (that ain't critical like data loss but might cause unexpected errors) like two people viewing a model with some

Re: Improving MSSQL and Azure SQL support on Django

2016-03-09 Thread Cristiano Coelho
"Improve documentation/examples [decrease confusion]: There's already so much awesome content out there on getting started with Django (but not many are referencing MSSQL as the db of choice or why MSSQL is a great option)." I wouldn't think of MSSQL as a great option for django at least until

Re: [ GSoC2016 ] Integration of django and angular2

2016-03-09 Thread Cristiano Coelho
In my opinion angular + django + django-rest-framework is a very powerful combo, and using django templates mixed with angular (for anything else than the index page) is really a bad idea due to templates being very slow and rendered by python. Angular must run against a 100% web api with its

Re: [Question] jsi18n - get_javascript_catalog a bit obscure?

2016-03-04 Thread Cristiano Coelho
jango/django/blob/master/CONTRIBUTING.rst, > "non-trivial pull requests (anything more than fixing a typo) without Trac > tickets will be closed! Please file a ticket > <https://code.djangoproject.com/newticket> to suggest changes." > > On Friday, March 4, 2016 a

Re: [Question] jsi18n - get_javascript_catalog a bit obscure?

2016-03-04 Thread Cristiano Coelho
Would a pull request be accepted? Does it need to be a new branch even if the change is just a few lines? Does it need an open ticket first? El martes, 1 de marzo de 2016, 22:26:00 (UTC-3), Cristiano Coelho escribió: > > Looking through git history seems like the "always l

Re: Django admin and messages

2016-03-03 Thread Cristiano Coelho
jueves, 3 de marzo de 2016, 23:31:19 (UTC-3), Ramiro Morales escribió: > > On Thu, Mar 3, 2016 at 11:06 PM, Cristiano Coelho <cristia...@gmail.com > > wrote: > >> By "we are doing" do you mean that's how it is translated by django, or >> are you patching tran

Re: Django admin and messages

2016-03-03 Thread Cristiano Coelho
aude Paroz escribió: > > Le mercredi 2 mars 2016 02:42:05 UTC+1, Cristiano Coelho a écrit : >> >> Another approach for gender languages like spanish would be to use "el >> objeto %(obj)" rather than "el/la %(obj)". >> > > That's exactly what we

Re: Django admin and messages

2016-03-01 Thread Cristiano Coelho
Actual file with the issue: https://github.com/django/django/blob/master/django/contrib/admin/locale/es/LC_MESSAGES/django.po#L168 El martes, 1 de marzo de 2016, 22:42:05 (UTC-3), Cristiano Coelho escribió: > > Looking it deeper it seems mostly like a translation issue for the s

Re: Django admin and messages

2016-03-01 Thread Cristiano Coelho
is definitely better than "el" and having a female object following it. Another approach for gender languages like spanish would be to use "el objeto %(obj)" rather than "el/la %(obj)". El sábado, 20 de febrero de 2016, 16:51:27 (UTC-3), Cristiano Coelho escribió

Re: [Question] jsi18n - get_javascript_catalog a bit obscure?

2016-03-01 Thread Cristiano Coelho
e in question and > try a more directed query like a ping in IRC). > > On Tuesday, March 1, 2016 at 6:23:38 PM UTC-5, Cristiano Coelho wrote: >> >> Maybe I wasn't clear neither, but the main issue is this: when using a >> language equals to the default one, and if that languag

Re: [Question] jsi18n - get_javascript_catalog a bit obscure?

2016-03-01 Thread Cristiano Coelho
Maybe I wasn't clear neither, but the main issue is this: when using a language equals to the default one, and if that language does not define any translation text (because ids are the same as values so it is not necessary), the server side translations will always correctly return the

[Question] jsi18n - get_javascript_catalog a bit obscure?

2016-03-01 Thread Cristiano Coelho
https://github.com/django/django/blob/master/django/views/i18n.py#L204 Can someone explain me why does it have to always load english as the first fallback? Also, line 248: # If the currently selected language is English but it doesn't have a # translation catalog (presumably due to being

Re: Improving django.setup() and app loading performance

2016-02-29 Thread Cristiano Coelho
In my opinion, those latencies are still a bit high, how much is really used on python/lambda code? On a project of mine without hitting the database and django-rest-framework my times were around 1-4ms excluding any network latency. Debug and loggers might have high impact on your times if

Re: Improving django.setup() and app loading performance

2016-02-29 Thread Cristiano Coelho
I think I have found your issue, if I'm not wrong, django won't initialize twice if you call it twice (which was your previous behaviour) at least not completely, since apps registry has a "ready" flag. Check this line: https://github.com/django/django/blob/master/django/apps/registry.py#L66

Re: Improving django.setup() and app loading performance

2016-02-29 Thread Cristiano Coelho
Rich, I have just performed a real test, with a simple lambda and a datetime.now() defined at the top of the module as I said, and out of 100 requests, this was the result: {u'2016-03-01T00:37:30.476828': [43], u'2016-03-01T00:36:51.536025': [58]} Where the date is the datetime.now() defined at

Re: Improving django.setup() and app loading performance

2016-02-29 Thread Cristiano Coelho
(UTC-3), Cristiano Coelho escribió: > > That's quite odd, I recall testing this once, where I created a lambda > which had a datetime.now() at the top, and just returned that value. Out of > a few calls, it returned two different results, meaning the module was re > used &qu

Re: Improving django.setup() and app loading performance

2016-02-29 Thread Cristiano Coelho
That's quite odd, I recall testing this once, where I created a lambda which had a datetime.now() at the top, and just returned that value. Out of a few calls, it returned two different results, meaning the module was re used "most" of the time. This was tested calling the lambda from the AWS

Re: Improving django.setup() and app loading performance

2016-02-29 Thread Cristiano Coelho
internals than I do, so all > suggestions are welcome! > > R > > On Tuesday, March 1, 2016 at 12:57:28 AM UTC+1, Cristiano Coelho wrote: >> >> Sorry if this looks like a retarded question, but have you tried the >> setup calls to the top of the lambda_handler module?

Re: Making max_length argument optional

2016-02-29 Thread Cristiano Coelho
I find that using TextField rather than CharField just to make postgres use varchar() is a terrible idea, if you are implementing an reusable app and it is used on a backend like MySQL where TextFields are created as text columns which are horribly inneficient and should be avoided at any cost

Re: Improving django.setup() and app loading performance

2016-02-29 Thread Cristiano Coelho
Sorry if this looks like a retarded question, but have you tried the setup calls to the top of the lambda_handler module? I'm not sure why you need the settings data as an argument to the lambda handler, but if you find a way to move those 4 lines near setup(), you will only load the whole

Re: Improving django.setup() and app loading performance

2016-02-26 Thread Cristiano Coelho
Rich, I believe you know a lot way more than me about AWS Lambda since you have made such a great project, and I'm really interested to know how it really works since theyr documentation is a bit superficial. On their FAQ this is what they state: *Q: Will AWS Lambda reuse function instances?*

Re: Improving django.setup() and app loading performance

2016-02-26 Thread Cristiano Coelho
If with "serverless" you are talking deployments such as Amazon Lambda or similar, I don't think setup is called on every request, at least for AWS Lambda, the enviorment is cached so it will only happen once each time it needs to scale up. Are there any other issues? El viernes, 26 de febrero

Django admin and messages

2016-02-20 Thread Cristiano Coelho
Hello, It seems that all admin "sucess" (and others) messages are hardcoded (almost, actually translations) into the methods that use them and can not be easily changed (like 'The %(name)s "%(obj)s" was added successfully. You may add another %(name)s below.'). This is causing some issues on

Composite Primary Keys

2016-02-16 Thread Cristiano Coelho
Hello there, What's the status for this? This (https://code.djangoproject.com/wiki/MultipleColumnPrimaryKeys) is 3 years old (last edit) and the links on it are even older. Googling around only gave me some very old projects so it wasn't good neither. -- You received this message because you

Re: Announcing Django-Zappa - Serverless Django on AWS Lambda + API Gateway

2016-02-08 Thread Cristiano Coelho
Hello, I would like to suggest that you include the limitations AWS Lambda and API Gateway has, since I have used them and it is not suitable for every use case. For example, one of the biggest limitations is that an Lambda can run for at most 5 minutes, but if paired with API Gateway, it can

Re: Admin Improvement - Autocomplete & improved search for FKs

2016-02-03 Thread Cristiano Coelho
ption. > > On Tuesday, February 2, 2016 at 10:20:07 PM UTC-5, Cristiano Coelho wrote: >> >> >> <https://lh3.googleusercontent.com/-RY84l0o3Ac0/VrFszlul9uI/AGg/0SxzpJ86MLs/s1600/improved_search.PNG> >> >> >> <https://lh3.googleusercontent.com

Admin Improvement - Autocomplete & improved search for FKs

2016-02-02 Thread Cristiano Coelho
Hello, On one of my projects I'm using django-grappelli to improve the

Re: Improving MSSQL and Azure SQL support on Django

2016-01-28 Thread Cristiano Coelho
ive you the > performance you need without stepping on anyone's toes. > > On Wednesday, January 27, 2016 at 12:15:48 AM UTC-5, Cristiano Coelho > wrote: >> >> I'm interested in the progress of this as well :) >> >> Sorry I didn't read through all the posts,

Re: Improving MSSQL and Azure SQL support on Django

2016-01-26 Thread Cristiano Coelho
I'm interested in the progress of this as well :) Sorry I didn't read through all the posts, mostly the first ones about the idea. I would like to know, have you guys decided on which adapter to use? I have had a project where we needed to connect to SQL Server from a linux machine (actually

Re: PostGres 9.5 Upsert

2016-01-09 Thread Cristiano Coelho
I agree! Also, does this already happen for the MySQL backend? MySQL has the insert on conflict update, that could work the same way. However, if I'm not wrong, the docs states that the above methods have a race condition (obvious since right now it does two operations), but if the code would

Re: delegating our static file serving

2015-12-30 Thread Cristiano Coelho
Just curious, about PaaS, I know AWS (Amazon) deploys python/django on apache (which is quite decent), and apache also serves static files decently. What would be wrong with this? The idea of having Python serving static files (and potentially gziping it), when python is one of the slowest

Re: Deprecations vs. backwards-incompatible changes for tightening behavior that hides probable developer error

2015-12-21 Thread Cristiano Coelho
Hello, the select_related change was a really good one, after updating I found around 3 or 4 queries that had a typo in select_related which was obviously never noticed before. In this project finding those errors was not complicated at all, but I believe that on a big project that also has

Re: [Question] MySQL Microseconds stripping

2015-12-21 Thread Cristiano Coelho
hat's not possible > then we should have a migration or script that'll do the conversion on > behalf of users once off. > > ./manage.py mysql-upgrade-microseconds && ./manage.py migrate ? > > > On Monday, 21 December 2015 19:39:44 UTC+11, Aymeric Augustin wrote: &g

Re: [Question] MySQL Microseconds stripping

2015-12-20 Thread Cristiano Coelho
escribió: > > > > Den 20. dec. 2015 kl. 01.04 skrev Cristiano Coelho <cristia...@gmail.com > >: > > > > About using a custom datetime field that strips microseconds, that won't > work for raw queries I believe, not even .update statements as they ignore > pre-

Re: [Question] MySQL Microseconds stripping

2015-12-19 Thread Cristiano Coelho
Aymeric is right. I do an insert with microseconds (since that's what django does right now) but mysql has the column defined as datetime(0), so it just strips the microsecond part, however, when doing the select, I'm expecting to get the value I have just inserted, but it doesn't work, since

Re: [Question] MySQL Microseconds stripping

2015-12-18 Thread Cristiano Coelho
any way to get back the old django behaviour for mysql, through a setting, or monkey patch (as long as it works for all models and raw queries). El sábado, 19 de diciembre de 2015, 1:59:00 (UTC-3), Erik Cederstrand escribió: > > > > Den 19. dec. 2015 kl. 07.52 skrev Cristiano Coe

Re: [Question] MySQL Microseconds stripping

2015-12-18 Thread Cristiano Coelho
to match the fractional date. This makes me think if this might be a bug with mysql... El viernes, 18 de diciembre de 2015, 21:52:43 (UTC-3), Cristiano Coelho escribió: > > Hello, > > After django 1.8, the mysql backend no longer strips microseconds. > This is giving me some issues

[Question] MySQL Microseconds stripping

2015-12-18 Thread Cristiano Coelho
Hello, After django 1.8, the mysql backend no longer strips microseconds. This is giving me some issues when upgrading from 1.7 (I actually upgraded to 1.9 directly), since date times are not stored with micro second precision on mysql, but the queries are sent with them. As I see it, my only

Re: [Question] Many-To-Many query where only pk is returned

2015-11-19 Thread Cristiano Coelho
al > handling to reference `book_id` since it's not actually a primary key on > the intermediate table. > > Simon > > Le mercredi 18 novembre 2015 19:41:22 UTC-5, Cristiano Coelho a écrit : >> >> Hello there, >> >> Lets say I have these two models (sorry a

Re: [Question] Many-To-Many query where only pk is returned

2015-11-19 Thread Cristiano Coelho
here. I haven't > tested, so I'm not sure if django does duplicate elimination, but I'm > pretty sure it doesn't. > > Does this look right to you, or am I missing something? > > Cheers > > > On Thursday, 19 November 2015 11:41:22 UTC+11, Cristiano Coelho wrote: >> >

[Question] Many-To-Many query where only pk is returned

2015-11-18 Thread Cristiano Coelho
Hello there, Lets say I have these two models (sorry about the spanish names!) ( Django 1.8.6 and MySQL backend ) class Especialidad(models.Model): nombre = models.CharField(max_length=250, blank=False, unique=True) class Usuario(AbstractBaseUser): permisosEspecialidad =

Re: [Feature Request] Performant values_list query

2015-11-16 Thread Cristiano Coelho
me improvements to performance where > they can be found. But you should make sure the kinds of changes you want > to make will have an impact when using the latest version of Django, > because some of the low hanging fruit may have already been patched. > > Cheers > > On Tuesday,

Re: [Feature Request] Performant values_list query

2015-11-16 Thread Cristiano Coelho
(UTC-3), Cristiano Coelho escribió: > > After some testing I have found out that even when using values_list to > prevent massive object creation when fetching data, it is from 2 to 3 times > slower tan using directly a cursor.execute query through the django cursor. > The iss

Re: [Feature Request] Performant values_list query

2015-11-16 Thread Cristiano Coelho
Interesting, maybe because I'm using MySQL with mysqlclient connector, but running the straight query with the django cursor wrapper always returns the correct data types, even dates with its it time zone when time zone is enabled, was it all coincidence? Would using a different backend break

Re: [Feature Request] Performant values_list query

2015-11-16 Thread Cristiano Coelho
Hi, thanks for the response! I have never developed nor ran the django test suite, I can certainly try as you mentioned, I was hoping for anyone that actually implemented values_list to give me a solid reason to not do any change as I'm probably wrong and the current way it is implemented is

[Feature Request] Performant values_list query

2015-11-16 Thread Cristiano Coelho
I would like to add, that minor change on a critical query meant an increase from 37 to 47 requests per second on a benchmark test with apache, that's a 22% improvement that will be bigger on larger results (this was just with 700 rows result set), compared to using some pagination with a limit

Transaction management and atomic

2014-09-30 Thread Cristiano Coelho
Hello there, I have recently updated to django 1.7, from 1.5 and one of the main changes I had to do was to replace all deprecated transaction.commit_manually to transaction.atomic, so far so good. After this, I have found out that if an IntegrityError or DatabaseError exception happen inside