Spatial lookups for RasterField
Hello Everyone I have been working on adding spatial lookups for the RasterField in the GIS module. https://github.com/django/django/pull/5460#issuecomment-152606283 I would like to get feedback regarding API design for the lookups. The challenge is that one needs to specify two parameters for the lookup: the raster itself and a band index. I think everything should default to the first band, as many rasters only have one band. For the special cases, an index has to be specified. On the right hand side (rhs) the proposal is to use a syntax similar to the existing distance lookups, providing a tuple: (raster, band_index). That follows previous art and should be ok. But on the left hand side (lhs) its less clear to me what to do. For instance, to compare band 2 from a raster field "elevation" with a geometry, I can see two options A specify the index with a double underscore: elevation__2__intersects=geom B pass the band index on the rhs: elevation__intersects=(geom, 2) The current implementation in the PR above uses the second option. But I have doubts because that mixes the lhs with the rhs. Here are my questions: - Are there other options for the api that shoudl be considered? - If not, which of the two approaches would be better? Thanks, Daniel -- 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/a67874c5-f1d4-44f1-a0c6-97765544125a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: Improving MSSQL and Azure SQL support on Django
Thanks to everyone for their efforts; my workplace has a mix of SQL Server and PostgreSQL, heavier on the SQL Server side. Due to some groups reliance on SSIS and tight SQL Server integration with data vendors, that isn't going to change any time soon, so this is project is one we're following closely as well. We've tried to contribute by way of feedback, testing various configurations with various drivers, some documentation and a minuscule amount of code contribution. In case this anecdotal evidence helps anyone in the meantime, the stack we've found most reliable these days (from RedHat / CentOS, at least, but also partially tested on Ubuntu) is: - FreeTDS 0.95 (supports TDS version 7.3) with unixODBC. We tried the Microsoft provided ODBC driver, but ran into quite a few issues, particularly with multi-threading. - pyodbc 3.0.10. pyodbc just works. We get slightly better performance with pymssql, but have found pyodbc to be more frequently updated and rock-solid. The performance upgrade didn't warrant using pymssql in our case, but is worth mentioning. - django-pyodbc-azure. This is kept up to date with Django and Python release versions, and works with the least amount of configuration tweaking that we have found. We're on a mix of RHEL/CentOS 6 and 7, and have gotten this stack running reliably up to v7.2. YMMV, of course! As for the C dependencies, have you considered building the C binaries necessary on another server, and then just including them as part of a wheel (or something like that) for installation were you couldn't install? This sound like a perfect use case for a temporary vagrant box you could blow away after compiling. Just a thought that might give 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, 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 amazon lambda) and even worse, we couldn't install any > library with dependencies on C code, so we used one that was implemented in > pure python that worked very well (pytds if I'm not wrong), with ofcourse, > not the best performance. > Why do I tell this? Because even if you want django to run on SQL Server, > it doesn't really mean you want to run it on a Windows machine, actually, > that would probably be a terrible idea (no ofense), since apache works > horribly bad on Windows, and Linux is atually the best OS to run a web > server with python code (either nginx or apache). So please keep this in > mind when chosing a connector, since if it has C dependencies (which it > will probably have, since the pure python ones are quite slow). > > About if you need different connectors for Azure or SQLServer, I'm > 'almost' sure you don't, we use azure or other cloud based sqlserver > deployments with no problem with standard sqlserver connectors. > > So basically, do not aim this towards making django more Windows friendly, > but rather the actual SQL Server backend. > > El lunes, 25 de enero de 2016, 22:59:07 (UTC-3), Fabio Caritas Barrionuevo > da Luz escribió: >> >> is there any update about the progress of this? >> >> -- >> Fábio C. Barrionuevo da Luz >> Palmas - Tocantins - Brasil - América do Sul >> >> >> >> Em terça-feira, 13 de outubro de 2015 18:12:55 UTC-3, Tim Graham escreveu: >>> >>> If anyone is interested in listening in on the meetings with Microsoft >>> engineers (Wednesday and Thursday 9am-5pm Pacific), let me know and I'll >>> send you the Skype link. >>> >>> On Friday, October 2, 2015 at 11:53:17 AM UTC-7, Meet Bhagdev wrote: On Thursday, October 1, 2015 at 12:32:25 PM UTC-7, Tim Graham wrote: > > Hi Meet, > > I was wondering > > 1. If you have any progress updates since your last message? > * Yes, engineers on my team I are currently ramping up on the three Django-SQL Server adapters* - * Django-pymssql* - * Django-pyodbc-azure* - * Django-mssql * * The goal is to have a thorough understanding of what’s good and what’s bad with these adapters before the event. * > > 2. If you have any further details on the schedule for the time in > Seattle in a week and a half? (including video conference details for > those > unable to attend in person) > - *We will have a video conference link for Day 2 and Day 3. Participants interested can join the conference stream from their browser. The conference room mics are only capable to a certain extent. Thus the quality might be a little poor. * - *
Re: Improving MSSQL and Azure SQL support on Django
Tim Allen, What you said about compiling the C dependencies on a similar machine and then upload it all together indeed works (it was one of the options) but caused some other issues (ie: we usually develop on Windows, and also the compiled libraries are very platform specific) and performance was really not that important in this case. But just letting you know that your idea works most of the time if you are willing to take the extra work. El jueves, 28 de enero de 2016, 12:48:29 (UTC-3), Tim Allen escribió: > > Thanks to everyone for their efforts; my workplace has a mix of SQL Server > and PostgreSQL, heavier on the SQL Server side. Due to some groups reliance > on SSIS and tight SQL Server integration with data vendors, that isn't > going to change any time soon, so this is project is one we're following > closely as well. We've tried to contribute by way of feedback, testing > various configurations with various drivers, some documentation and a > minuscule amount of code contribution. > > In case this anecdotal evidence helps anyone in the meantime, the stack > we've found most reliable these days (from RedHat / CentOS, at least, but > also partially tested on Ubuntu) is: > > - FreeTDS 0.95 (supports TDS version 7.3) with unixODBC. We tried the > Microsoft provided ODBC driver, but ran into quite a few issues, > particularly with multi-threading. > - pyodbc 3.0.10. pyodbc just works. We get slightly better performance > with pymssql, but have found pyodbc to be more frequently updated and > rock-solid. The performance upgrade didn't warrant using pymssql in our > case, but is worth mentioning. > - django-pyodbc-azure. This is kept up to date with Django and Python > release versions, and works with the least amount of configuration tweaking > that we have found. > > We're on a mix of RHEL/CentOS 6 and 7, and have gotten this stack running > reliably up to v7.2. YMMV, of course! > > As for the C dependencies, have you considered building the C binaries > necessary on another server, and then just including them as part of a > wheel (or something like that) for installation were you couldn't install? > This sound like a perfect use case for a temporary vagrant box you could > blow away after compiling. Just a thought that might give 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, 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 amazon lambda) and even worse, we couldn't install any >> library with dependencies on C code, so we used one that was implemented in >> pure python that worked very well (pytds if I'm not wrong), with ofcourse, >> not the best performance. >> Why do I tell this? Because even if you want django to run on SQL Server, >> it doesn't really mean you want to run it on a Windows machine, actually, >> that would probably be a terrible idea (no ofense), since apache works >> horribly bad on Windows, and Linux is atually the best OS to run a web >> server with python code (either nginx or apache). So please keep this in >> mind when chosing a connector, since if it has C dependencies (which it >> will probably have, since the pure python ones are quite slow). >> >> About if you need different connectors for Azure or SQLServer, I'm >> 'almost' sure you don't, we use azure or other cloud based sqlserver >> deployments with no problem with standard sqlserver connectors. >> >> So basically, do not aim this towards making django more Windows >> friendly, but rather the actual SQL Server backend. >> >> El lunes, 25 de enero de 2016, 22:59:07 (UTC-3), Fabio Caritas >> Barrionuevo da Luz escribió: >>> >>> is there any update about the progress of this? >>> >>> -- >>> Fábio C. Barrionuevo da Luz >>> Palmas - Tocantins - Brasil - América do Sul >>> >>> >>> >>> Em terça-feira, 13 de outubro de 2015 18:12:55 UTC-3, Tim Graham >>> escreveu: If anyone is interested in listening in on the meetings with Microsoft engineers (Wednesday and Thursday 9am-5pm Pacific), let me know and I'll send you the Skype link. On Friday, October 2, 2015 at 11:53:17 AM UTC-7, Meet Bhagdev wrote: > > > > On Thursday, October 1, 2015 at 12:32:25 PM UTC-7, Tim Graham wrote: >> >> Hi Meet, >> >> I was wondering >> >> 1. If you have any progress updates since your last message? >> > > > * Yes, engineers on my team I are currently ramping up on the > three Django-SQL Server adapters* > > >- * Django-pymssql* >- * Django-pyodbc-azure* >- > * Django-mssql *