Question
stringlengths
25
7.47k
Q_Score
int64
0
1.24k
Users Score
int64
-10
494
Score
float64
-1
1.2
Data Science and Machine Learning
int64
0
1
is_accepted
bool
2 classes
A_Id
int64
39.3k
72.5M
Web Development
int64
0
1
ViewCount
int64
15
1.37M
Available Count
int64
1
9
System Administration and DevOps
int64
0
1
Networking and APIs
int64
0
1
Q_Id
int64
39.1k
48M
Answer
stringlengths
16
5.07k
Database and SQL
int64
1
1
GUI and Desktop Applications
int64
0
1
Python Basics and Environment
int64
0
1
Title
stringlengths
15
148
AnswerCount
int64
1
32
Tags
stringlengths
6
90
Other
int64
0
1
CreationDate
stringlengths
23
23
Using pysqlite how can a user-defined-type be used as a value in a comparison, e. g: “... WHERE columnName > userType”? For example, I've defined a bool type with the requisite registration, converter, etc. Pysqlite/Sqlite responds as expected for INSERT and SELECT operations (bool 'True' stored as an integer 1 and ret...
1
0
0
0
false
610,761
0
671
1
0
0
609,516
You probably have to cast it to the correct type. Try "SELECT * FROM tasks WHERE (display = CAST ('True' AS bool))".
1
0
0
pysqlite user types in select statement
2
python,sqlite,pysqlite
0
2009-03-04T07:08:00.000
I often need to execute custom sql queries in django, and manually converting query results into objects every time is kinda painful. I wonder how fellow Slackers deal with this. Maybe someone had written some kind of a library to help dealing with custom SQL in Django?
2
3
1.2
0
true
620,117
1
3,263
1
0
0
619,384
Since the issue is "manually converting query results into objects," the simplest solution is often to see if your custom SQL can fit into an ORM .extra() call rather than being a pure-SQL query. Often it can, and then you let the ORM do all the work of building up objects as usual.
1
0
0
Tools to ease executing raw SQL with Django ORM
3
python,django,orm
0
2009-03-06T16:11:00.000
When I have created a table with an auto-incrementing primary key, is there a way to obtain what the primary key would be (that is, do something like reserve the primary key) without actually committing? I would like to place two operations inside a transaction however one of the operations will depend on what primary ...
53
-3
-0.291313
0
false
620,784
0
19,996
1
0
0
620,610
You can use multiple transactions and manage it within scope.
1
0
0
SQLAlchemy Obtain Primary Key With Autoincrement Before Commit
2
python,sql,sqlalchemy
0
2009-03-06T22:07:00.000
Our Python CMS stores some date values in a generic "attribute" table's varchar column. Some of these dates are later moved into a table with an actual date column. If the CMS user entered an invalid date, it doesn't get caught until the migration, when the query fails with an "Invalid string date" error. How can I u...
1
1
0.066568
0
false
640,115
0
902
2
0
0
639,949
The format of a date string that Oracle recognizes as a date is a configurable property of the database and as such it's considered bad form to rely on implicit conversions of strings to dates. Typically Oracle dates format to 'DD-MON-YYYY' but you can't always rely on it being set that way. Personally I would have the...
1
0
0
Validating Oracle dates in Python
3
python,oracle,validation
0
2009-03-12T18:41:00.000
Our Python CMS stores some date values in a generic "attribute" table's varchar column. Some of these dates are later moved into a table with an actual date column. If the CMS user entered an invalid date, it doesn't get caught until the migration, when the query fails with an "Invalid string date" error. How can I u...
1
-1
-0.066568
0
false
640,153
0
902
2
0
0
639,949
Validate as early as possible. Why don't you store dates as dates in your Python CMS? It is difficult to know what date a string like '03-04-2008' is. Is it 3 april 2008 or 4 march 2008? An American will say 4 march 2008 but a Dutch person will say 3 april 2008.
1
0
0
Validating Oracle dates in Python
3
python,oracle,validation
0
2009-03-12T18:41:00.000
I am finding it difficult to use MySQL with Python in my windows system. I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn't generate ...
102
1
0.012499
0
false
5,294,670
0
110,355
1
0
0
645,943
Because I am running python in a (pylons/pyramid) virtualenv, I could not run the binary installers (helpfully) linked to previously. I had problems following the steps with Willie's answer, but I determined that the problem is (probably) that I am running windows 7 x64 install, which puts the registry key for mysql i...
1
0
1
Integrating MySQL with Python in Windows
16
python,mysql,windows
0
2009-03-14T13:53:00.000
OMG! What an apparent problem... my django based scripts have locked my sqlite db... Does anyone know how to fix?
1
6
1.2
0
true
652,758
1
4,579
1
0
0
652,750
Your database is locked because you have a transaction running somewhere. Stop all your Django apps. If necessary, reboot. It's also remotely possible that you crashed a SQLite client in the middle of a transaction and the file lock was left in place.
1
0
0
How to unlock an sqlite3 db?
2
python,django
0
2009-03-17T01:33:00.000
I've added new models and pushed to our staging server, run syncdb to create their tables, and it locks up. It gets as far as 'Create table photos_photousertag' and postgres output shows the notice for creation of 'photos_photousertag_id_seq', but otherwise i get nothing on either said. I can't ctrl+c the syncdb proces...
3
0
0
0
false
21,254,637
1
985
3
0
0
674,030
Strange here too, but simply restarting the PostgreSQL service (or server) solved it. I'd tried manually pasting the table creation code in psql too, but that wasn't solving it either (well, no way it could if it was a lock thing) - so I just used the restart: systemctl restart postgresql.service that's on my Suse b...
1
0
0
Django syncdb locking up on table creation
3
python,django,django-syncdb
0
2009-03-23T16:16:00.000
I've added new models and pushed to our staging server, run syncdb to create their tables, and it locks up. It gets as far as 'Create table photos_photousertag' and postgres output shows the notice for creation of 'photos_photousertag_id_seq', but otherwise i get nothing on either said. I can't ctrl+c the syncdb proces...
3
1
0.066568
0
false
10,438,955
1
985
3
0
0
674,030
I just experienced this as well, and it turned out to just be a plain old lock on that particular table, unrelated to Django. Once that cleared the sync went through just fine. Try querying the table that the sync is getting stuck on and make sure that's working correctly first.
1
0
0
Django syncdb locking up on table creation
3
python,django,django-syncdb
0
2009-03-23T16:16:00.000
I've added new models and pushed to our staging server, run syncdb to create their tables, and it locks up. It gets as far as 'Create table photos_photousertag' and postgres output shows the notice for creation of 'photos_photousertag_id_seq', but otherwise i get nothing on either said. I can't ctrl+c the syncdb proces...
3
1
0.066568
0
false
674,105
1
985
3
0
0
674,030
We use postgres, and while we've not run into this particular issue, there are some steps you may find helpful in debugging: a. What version of postgres and psycopg2 are you using? For that matter, what version of django? b. Try running the syncdb command with the "--verbosity=2" option to show all output. c. Find the ...
1
0
0
Django syncdb locking up on table creation
3
python,django,django-syncdb
0
2009-03-23T16:16:00.000
Let's say I have two or more processes dealing with an SQLite database - a "player" process and many "editor" processes. The "player" process reads the database and updates a view - in my case it would be a waveform being mixed to the soundcard depending on events stored in the database. An "editor" process is any edi...
15
2
0.049958
0
false
677,042
0
15,631
5
0
0
677,028
Just open a socket between the two processes and have the editor tell all the players about the update.
1
0
0
How do I notify a process of an SQLite database change done in a different process?
8
python,sqlite,notifications
0
2009-03-24T11:34:00.000
Let's say I have two or more processes dealing with an SQLite database - a "player" process and many "editor" processes. The "player" process reads the database and updates a view - in my case it would be a waveform being mixed to the soundcard depending on events stored in the database. An "editor" process is any edi...
15
2
0.049958
0
false
677,215
0
15,631
5
0
0
677,028
I think in that case, I would make a process to manage the database read/writes. Each editor that want to make some modifications to the database makes a call to this proccess, be it through IPC or network, or whatever method. This process can then notify the player of a change in the database. The player, when he want...
1
0
0
How do I notify a process of an SQLite database change done in a different process?
8
python,sqlite,notifications
0
2009-03-24T11:34:00.000
Let's say I have two or more processes dealing with an SQLite database - a "player" process and many "editor" processes. The "player" process reads the database and updates a view - in my case it would be a waveform being mixed to the soundcard depending on events stored in the database. An "editor" process is any edi...
15
2
0.049958
0
false
677,087
0
15,631
5
0
0
677,028
If it's on the same machine, the simplest way would be to have named pipe, "player" with blocking read() and "editors" putting a token in pipe whenever they modify DB.
1
0
0
How do I notify a process of an SQLite database change done in a different process?
8
python,sqlite,notifications
0
2009-03-24T11:34:00.000
Let's say I have two or more processes dealing with an SQLite database - a "player" process and many "editor" processes. The "player" process reads the database and updates a view - in my case it would be a waveform being mixed to the soundcard depending on events stored in the database. An "editor" process is any edi...
15
4
1.2
0
true
677,085
0
15,631
5
0
0
677,028
A relational database is not your best first choice for this. Why? You want all of your editors to pass changes to your player. Your player is -- effectively -- a server for all those editors. Your player needs multiple open connections. It must listen to all those connections for changes. It must display those ch...
1
0
0
How do I notify a process of an SQLite database change done in a different process?
8
python,sqlite,notifications
0
2009-03-24T11:34:00.000
Let's say I have two or more processes dealing with an SQLite database - a "player" process and many "editor" processes. The "player" process reads the database and updates a view - in my case it would be a waveform being mixed to the soundcard depending on events stored in the database. An "editor" process is any edi...
15
1
0.024995
0
false
677,169
0
15,631
5
0
0
677,028
How many editor processes (why processes?), and how often do you expect updates? This doesn't sound like a good design, especially not considering sqlite really isn't too happy about multiple concurrent accesses to the database. If multiple processes makes sense and you want persistence, it would probably be smarter to...
1
0
0
How do I notify a process of an SQLite database change done in a different process?
8
python,sqlite,notifications
0
2009-03-24T11:34:00.000
does anybody know what is the equivalent to SQL "INSERT OR REPLACE" clause in SQLAlchemy and its SQL expression language? Many thanks -- honzas
13
5
1.2
0
true
709,452
0
20,634
1
0
0
708,762
I don't think (correct me if I'm wrong) INSERT OR REPLACE is in any of the SQL standards; it's an SQLite-specific thing. There is MERGE, but that isn't supported by all dialects either. So it's not available in SQLAlchemy's general dialect. The cleanest solution is to use Session, as suggested by M. Utku. You could ...
1
0
0
SQLAlchemy - INSERT OR REPLACE equivalent
4
python,sqlalchemy
0
2009-04-02T08:05:00.000
Yes, this is as stupid a situation as it sounds like. Due to some extremely annoying hosting restrictions and unresponsive tech support, I have to use a CSV file as a database. While I can use MySQL with PHP, I can't use it with the Python backend of my program because of install issues with the host. I can't use S...
4
0
0
0
false
1,396,578
0
2,433
9
0
0
712,510
Disagreeing with the noble colleagues, I often use DBD::CSV from Perl. There are good reasons to do it. Foremost is data update made simple using a spreadsheet. As a bonus, since I am using SQL queries, the application can be easily upgraded to a real database engine. Bear in mind these were extremely small databas...
1
0
0
Using CSV as a mutable database?
12
python,csv
0
2009-04-03T04:02:00.000
Yes, this is as stupid a situation as it sounds like. Due to some extremely annoying hosting restrictions and unresponsive tech support, I have to use a CSV file as a database. While I can use MySQL with PHP, I can't use it with the Python backend of my program because of install issues with the host. I can't use S...
4
0
0
0
false
713,531
0
2,433
9
0
0
712,510
What about postgresql? I've found that quite nice to work with, and python supports it well. But I really would look for another provider unless it's really not an option.
1
0
0
Using CSV as a mutable database?
12
python,csv
0
2009-04-03T04:02:00.000
Yes, this is as stupid a situation as it sounds like. Due to some extremely annoying hosting restrictions and unresponsive tech support, I have to use a CSV file as a database. While I can use MySQL with PHP, I can't use it with the Python backend of my program because of install issues with the host. I can't use S...
4
1
0.016665
0
false
713,396
0
2,433
9
0
0
712,510
"Anyways, now, the question: is it possible to update values SQL-style in a CSV database?" Technically, it's possible. However, it can be hard. If both PHP and Python are writing the file, you'll need to use OS-level locking to assure that they don't overwrite each other. Each part of your system will have to lock th...
1
0
0
Using CSV as a mutable database?
12
python,csv
0
2009-04-03T04:02:00.000
Yes, this is as stupid a situation as it sounds like. Due to some extremely annoying hosting restrictions and unresponsive tech support, I have to use a CSV file as a database. While I can use MySQL with PHP, I can't use it with the Python backend of my program because of install issues with the host. I can't use S...
4
0
0
0
false
712,567
0
2,433
9
0
0
712,510
I agree. Tell them that 5 random strangers agree that you being forced into a corner to use CSV is absurd and unacceptable.
1
0
0
Using CSV as a mutable database?
12
python,csv
0
2009-04-03T04:02:00.000
Yes, this is as stupid a situation as it sounds like. Due to some extremely annoying hosting restrictions and unresponsive tech support, I have to use a CSV file as a database. While I can use MySQL with PHP, I can't use it with the Python backend of my program because of install issues with the host. I can't use S...
4
1
0.016665
0
false
712,568
0
2,433
9
0
0
712,510
You can probably used sqlite3 for more real database. It's hard to imagine hosting that won't allow you to install it as a python module. Don't even think of using CSV, your data will be corrupted and lost faster than you say "s#&t"
1
0
0
Using CSV as a mutable database?
12
python,csv
0
2009-04-03T04:02:00.000
Yes, this is as stupid a situation as it sounds like. Due to some extremely annoying hosting restrictions and unresponsive tech support, I have to use a CSV file as a database. While I can use MySQL with PHP, I can't use it with the Python backend of my program because of install issues with the host. I can't use S...
4
1
0.016665
0
false
712,522
0
2,433
9
0
0
712,510
I couldn't imagine this ever being a good idea. The current mess I've inherited writes vital billing information to CSV and updates it after projects are complete. It runs horribly and thousands of dollars are missed a month. For the current restrictions that you have, I'd consider finding better hosting.
1
0
0
Using CSV as a mutable database?
12
python,csv
0
2009-04-03T04:02:00.000
Yes, this is as stupid a situation as it sounds like. Due to some extremely annoying hosting restrictions and unresponsive tech support, I have to use a CSV file as a database. While I can use MySQL with PHP, I can't use it with the Python backend of my program because of install issues with the host. I can't use S...
4
1
0.016665
0
false
712,515
0
2,433
9
0
0
712,510
Keep calling on the help desk. While you can use a CSV as a database, it's generally a bad idea. You would have to implement you own locking, searching, updating, and be very careful with how you write it out to make sure that it isn't erased in case of a power outage or other abnormal shutdown. There will be no transa...
1
0
0
Using CSV as a mutable database?
12
python,csv
0
2009-04-03T04:02:00.000
Yes, this is as stupid a situation as it sounds like. Due to some extremely annoying hosting restrictions and unresponsive tech support, I have to use a CSV file as a database. While I can use MySQL with PHP, I can't use it with the Python backend of my program because of install issues with the host. I can't use S...
4
0
0
0
false
712,512
0
2,433
9
0
0
712,510
I'd keep calling help desk. You don't want to use CSV for data if it's relational at all. It's going to be nightmare.
1
0
0
Using CSV as a mutable database?
12
python,csv
0
2009-04-03T04:02:00.000
Yes, this is as stupid a situation as it sounds like. Due to some extremely annoying hosting restrictions and unresponsive tech support, I have to use a CSV file as a database. While I can use MySQL with PHP, I can't use it with the Python backend of my program because of install issues with the host. I can't use S...
4
0
0
0
false
712,974
0
2,433
9
0
0
712,510
If I understand you correctly: you need to access the same database from both python and php, and you're screwed because you can only use mysql from php, and only sqlite from python? Could you further explain this? Maybe you could use xml-rpc or plain http requests with xml/json/... to get the php program to communicat...
1
0
0
Using CSV as a mutable database?
12
python,csv
0
2009-04-03T04:02:00.000
I am trying to do the schedule for the upcoming season for my simulation baseball team. I have an existing Postgresql database that contains the old schedule. There are 648 rows in the database: 27 weeks of series for 24 teams. The problem is that the schedule has gotten predictable and allows teams to know in advanc...
0
2
0.132549
0
false
719,913
0
2,359
2
0
0
719,886
Have you considered keeping your same "schedule", and just shuffling the teams? Generating a schedule where everyone plays each other the proper number of times is possible, but if you already have such a schedule then it's much easier to just shuffle the teams. You could keep your current table, but replace each team...
1
0
0
Help Me Figure Out A Random Scheduling Algorithm using Python and PostgreSQL
3
python,postgresql
0
2009-04-05T23:34:00.000
I am trying to do the schedule for the upcoming season for my simulation baseball team. I have an existing Postgresql database that contains the old schedule. There are 648 rows in the database: 27 weeks of series for 24 teams. The problem is that the schedule has gotten predictable and allows teams to know in advanc...
0
1
0.066568
0
false
719,909
0
2,359
2
0
0
719,886
I'm not sure I fully understand the problem, but here is how I would do it: 1. create a complete list of matches that need to happen 2. iterate over the weeks, selecting which match needs to happen in this week. You can use Python lists to represent the matches that still need to happen, and, for each week, the matches...
1
0
0
Help Me Figure Out A Random Scheduling Algorithm using Python and PostgreSQL
3
python,postgresql
0
2009-04-05T23:34:00.000
I'm working with a 20 gig XML file that I would like to import into a SQL database (preferably MySQL, since that is what I am familiar with). This seems like it would be a common task, but after Googling around a bit I haven't been able to figure out how to do it. What is the best way to do this? I know this ability i...
5
0
0
0
false
723,931
0
12,197
1
0
0
723,757
It may be a common task, but maybe 20GB isn't as common with MySQL as it is with SQL Server. I've done this using SQL Server Integration Services and a bit of custom code. Whether you need either of those depends on what you need to do with 20GB of XML in a database. Is it going to be a single column of a single row of...
1
0
0
Import XML into SQL database
5
python,sql,xml
0
2009-04-07T00:39:00.000
I've written a web-app in python using SQLite and it runs fine on my server at home (with apache and python 2.5.2). I'm now trying to upload it to my web host and there servers use python 2.2.3 without SQLite. Anyone know of a way to use SQLite in python 2.2.3 e.g. a module that I can upload and import? I've tried butc...
1
2
0.099668
0
false
737,617
0
1,012
2
0
0
737,511
There is no out-of-the-box solution; you either have to backport the SQLlite module from Python 2.5 to Python 2.2 or ask your web hoster to upgrade to the latest Python version. Python 2.2 is really ancient! At least for security reasons, they should upgrade (no more security fixes for 2.2 since May 30, 2003!). Note t...
1
0
0
SQLite in Python 2.2.3
4
python,sql,linux,sqlite,hosting
0
2009-04-10T12:40:00.000
I've written a web-app in python using SQLite and it runs fine on my server at home (with apache and python 2.5.2). I'm now trying to upload it to my web host and there servers use python 2.2.3 without SQLite. Anyone know of a way to use SQLite in python 2.2.3 e.g. a module that I can upload and import? I've tried butc...
1
0
0
0
false
4,066,757
0
1,012
2
0
0
737,511
In case anyone comes across this question, the reason why neither pysqlite nor APSW are available for Python 2.2 is because Python 2.3 added the simplified GIL API. Prior to Python 2.3 it required a lot of code to keep track of the GIL. (The GIL is the lock used by Python to ensure correct behaviour while multi-threa...
1
0
0
SQLite in Python 2.2.3
4
python,sql,linux,sqlite,hosting
0
2009-04-10T12:40:00.000
I'm trying to use SQLAlchemy to implement a basic users-groups model where users can have multiple groups and groups can have multiple users. When a group becomes empty, I want the group to be deleted, (along with other things associated with the group. Fortunately, SQLAlchemy's cascade works fine with these more simp...
9
0
0
0
false
776,246
0
3,255
3
0
0
740,630
Could you post a sample of your table and mapper set up? It might be easier to spot what is going on. Without seeing the code it is hard to tell, but perhaps there is something wrong with the direction of the relationship?
1
0
0
SQLAlchemy many-to-many orphan deletion
4
python,sqlalchemy
0
2009-04-11T19:07:00.000
I'm trying to use SQLAlchemy to implement a basic users-groups model where users can have multiple groups and groups can have multiple users. When a group becomes empty, I want the group to be deleted, (along with other things associated with the group. Fortunately, SQLAlchemy's cascade works fine with these more simp...
9
3
1.2
0
true
763,256
0
3,255
3
0
0
740,630
The way I've generally handled this is to have a function on your user or group called leave_group. When you want a user to leave a group, you call that function, and you can add any side effects you want into there. In the long term, this makes it easier to add more and more side effects. (For example when you want...
1
0
0
SQLAlchemy many-to-many orphan deletion
4
python,sqlalchemy
0
2009-04-11T19:07:00.000
I'm trying to use SQLAlchemy to implement a basic users-groups model where users can have multiple groups and groups can have multiple users. When a group becomes empty, I want the group to be deleted, (along with other things associated with the group. Fortunately, SQLAlchemy's cascade works fine with these more simp...
9
3
0.148885
0
false
770,287
0
3,255
3
0
0
740,630
I think you want cascade='save, update, merge, expunge, refresh, delete-orphan'. This will prevent the "delete" cascade (which you get from "all") but maintain the "delete-orphan", which is what you're looking for, I think (delete when there are no more parents).
1
0
0
SQLAlchemy many-to-many orphan deletion
4
python,sqlalchemy
0
2009-04-11T19:07:00.000
Trying to understand S3...How do you limit access to a file you upload to S3? For example, from a web application, each user has files they can upload, but how do you limit access so only that user has access to that file? It seems like the query string authentication requires an expiration date and that won't work f...
10
1
0.049958
0
false
766,030
1
4,305
3
0
1
765,964
You will have to build the whole access logic to S3 in your applications
1
0
0
Amazon S3 permissions
4
python,django,amazon-web-services,amazon-s3
0
2009-04-19T19:51:00.000
Trying to understand S3...How do you limit access to a file you upload to S3? For example, from a web application, each user has files they can upload, but how do you limit access so only that user has access to that file? It seems like the query string authentication requires an expiration date and that won't work f...
10
8
1
0
false
768,090
1
4,305
3
0
1
765,964
Have the user hit your server Have the server set up a query-string authentication with a short expiration (minutes, hours?) Have your server redirect to #2
1
0
0
Amazon S3 permissions
4
python,django,amazon-web-services,amazon-s3
0
2009-04-19T19:51:00.000
Trying to understand S3...How do you limit access to a file you upload to S3? For example, from a web application, each user has files they can upload, but how do you limit access so only that user has access to that file? It seems like the query string authentication requires an expiration date and that won't work f...
10
14
1
0
false
768,050
1
4,305
3
0
1
765,964
There are various ways to control access to the S3 objects: Use the query string auth - but as you noted this does require an expiration date. You could make it far in the future, which has been good enough for most things I have done. Use the S3 ACLS - but this requires the user to have an AWS account and authentica...
1
0
0
Amazon S3 permissions
4
python,django,amazon-web-services,amazon-s3
0
2009-04-19T19:51:00.000
Given a time (eg. currently 4:24pm on Tuesday), I'd like to be able to select all businesses that are currently open out of a set of businesses. I have the open and close times for every business for every day of the week Let's assume a business can open/close only on 00, 15, 30, 45 minute marks of each hour I'm assu...
6
4
0.113791
0
false
775,354
0
1,489
5
0
0
775,161
You say you're using SOLR, don't care about storage, and want the lookups to be fast. Then instead of storing open/close tuples, index an entry for every open block of time at the level of granularity you need (15 mins). For the encoding itself, you could use just cumulative hours:minutes. For example, a store open f...
1
0
0
Efficiently determining if a business is open or not based on store hours
7
python,mysql,performance,solr
0
2009-04-21T23:48:00.000
Given a time (eg. currently 4:24pm on Tuesday), I'd like to be able to select all businesses that are currently open out of a set of businesses. I have the open and close times for every business for every day of the week Let's assume a business can open/close only on 00, 15, 30, 45 minute marks of each hour I'm assu...
6
8
1.2
0
true
775,247
0
1,489
5
0
0
775,161
If you are willing to just look at single week at a time, you can canonicalize all opening/closing times to be set numbers of minutes since the start of the week, say Sunday 0 hrs. For each store, you create a number of tuples of the form [startTime, endTime, storeId]. (For hours that spanned Sunday midnight, you'd hav...
1
0
0
Efficiently determining if a business is open or not based on store hours
7
python,mysql,performance,solr
0
2009-04-21T23:48:00.000
Given a time (eg. currently 4:24pm on Tuesday), I'd like to be able to select all businesses that are currently open out of a set of businesses. I have the open and close times for every business for every day of the week Let's assume a business can open/close only on 00, 15, 30, 45 minute marks of each hour I'm assu...
6
3
0.085505
0
false
775,175
0
1,489
5
0
0
775,161
Sorry I don't have an easy answer, but I can tell you that as the manager of a development team at a company in the late 90's we were tasked with solving this very problem and it was HARD. It's not the weekly hours that's tough, that can be done with a relatively small bitmask (168 bits = 1 per hour of the week), the t...
1
0
0
Efficiently determining if a business is open or not based on store hours
7
python,mysql,performance,solr
0
2009-04-21T23:48:00.000
Given a time (eg. currently 4:24pm on Tuesday), I'd like to be able to select all businesses that are currently open out of a set of businesses. I have the open and close times for every business for every day of the week Let's assume a business can open/close only on 00, 15, 30, 45 minute marks of each hour I'm assu...
6
0
0
0
false
775,459
0
1,489
5
0
0
775,161
Have you looked at how many unique open/close time combinations there are? If there are not that many, make a reference table of the unique combinations and store the index of the appropriate entry against each business. Then you only have to search the reference table and then find the business with those indices.
1
0
0
Efficiently determining if a business is open or not based on store hours
7
python,mysql,performance,solr
0
2009-04-21T23:48:00.000
Given a time (eg. currently 4:24pm on Tuesday), I'd like to be able to select all businesses that are currently open out of a set of businesses. I have the open and close times for every business for every day of the week Let's assume a business can open/close only on 00, 15, 30, 45 minute marks of each hour I'm assu...
6
1
0.028564
0
false
777,443
0
1,489
5
0
0
775,161
In your Solr index, instead of indexing each business as one document with hours, index every "retail session" for every business during the course of a week. For example if Joe's coffee is open Mon-Sat 6am-9pm and closed on Sunday, you would index six distinct documents, each with two indexed fields, "open" and "clo...
1
0
0
Efficiently determining if a business is open or not based on store hours
7
python,mysql,performance,solr
0
2009-04-21T23:48:00.000
I have a legacy database with an integer set as a primary key. It was initially managed manually, but since we are wanting to move to django, the admin tool seemed to be the right place to start. I created the model and am trying to set the primary key to be an autofield. It doesn't seem to be remembering the old id in...
1
2
1.2
0
true
778,346
1
454
1
0
0
777,778
The DB is responsible for managing the value of the ID. If you want to use AutoField, you have to change the column in the DB to use that. Django is not responsible for managing the generated ID
1
0
0
How do I set up a model to use an AutoField with a legacy database in Python?
1
python,django,oracle,autofield
0
2009-04-22T15:18:00.000
Python communicating with EXCEL... i need to find a way so that I can find/search a row for given column datas. Now, i m scanning entire rows one by one... It would be useful, If there is some functions like FIND/SEARCH/REPLACE .... I dont see these features in pyExcelerator or xlrd modules.. I dont want to use win32co...
2
0
0
0
false
779,599
0
7,840
3
0
0
778,093
With pyExcelerator you can do a simple optimization by finding the maximum row and column indices first (and storing them), so that you iterate over (row, i) for i in range(maxcol+1) instead of iterating over all the dictionary keys. That may be the best you get, unless you want to go through and build up a dictionary...
1
0
0
pyExcelerator or xlrd - How to FIND/SEARCH a row for the given few column data?
4
python,excel,search,pyexcelerator,xlrd
0
2009-04-22T16:23:00.000
Python communicating with EXCEL... i need to find a way so that I can find/search a row for given column datas. Now, i m scanning entire rows one by one... It would be useful, If there is some functions like FIND/SEARCH/REPLACE .... I dont see these features in pyExcelerator or xlrd modules.. I dont want to use win32co...
2
2
0.099668
0
false
779,030
0
7,840
3
0
0
778,093
You can't. Those tools don't offer search capabilities. You must iterate over the data in a loop and search yourself. Sorry.
1
0
0
pyExcelerator or xlrd - How to FIND/SEARCH a row for the given few column data?
4
python,excel,search,pyexcelerator,xlrd
0
2009-04-22T16:23:00.000
Python communicating with EXCEL... i need to find a way so that I can find/search a row for given column datas. Now, i m scanning entire rows one by one... It would be useful, If there is some functions like FIND/SEARCH/REPLACE .... I dont see these features in pyExcelerator or xlrd modules.. I dont want to use win32co...
2
2
0.099668
0
false
778,282
0
7,840
3
0
0
778,093
"Now, i m scanning entire rows one by one" What's wrong with that? "search" -- in a spreadsheet context -- is really complicated. Search values? Search formulas? Search down rows then across columns? Search specific columns only? Search specific rows only? A spreadsheet isn't simple text -- simple text processing...
1
0
0
pyExcelerator or xlrd - How to FIND/SEARCH a row for the given few column data?
4
python,excel,search,pyexcelerator,xlrd
0
2009-04-22T16:23:00.000
Currently I have tables like: Pages, Groups, GroupPage, Users, UserGroup. With pickled sets I can implement the same thing with only 3 tables: Pages, Groups, Users. set seems a natural choice for implementing ACL, as group and permission related operations can be expressed very naturally with sets. If I store the allow...
1
2
0.099668
0
false
791,425
1
2,877
2
0
0
790,613
Me, I'd stick with keeping persistent info in the relational DB in a form that's independent from a specific programming language used to access it -- much as I love Python (and that's a lot), some day I may want to access that info from some other language, and if I went for Python-specific formats... boy would I ever...
1
0
0
Using Python set type to implement ACL
4
python,set,acl,pickle
0
2009-04-26T10:37:00.000
Currently I have tables like: Pages, Groups, GroupPage, Users, UserGroup. With pickled sets I can implement the same thing with only 3 tables: Pages, Groups, Users. set seems a natural choice for implementing ACL, as group and permission related operations can be expressed very naturally with sets. If I store the allow...
1
2
0.099668
0
false
790,662
1
2,877
2
0
0
790,613
You need to consider what it is that a DBMS provides you with, and which of those features you'll need to reimplement. The issue of concurrency is a big one. There are a few race conditions to be considered (such as multiple writes taking place in different threads and processes and overwriting the new data), performan...
1
0
0
Using Python set type to implement ACL
4
python,set,acl,pickle
0
2009-04-26T10:37:00.000
I have downloaded & installed the latest Python InformixDB package, but when I try to import it from the shell, I am getting the following error in the form of a Windows dialog box! "A procedure entry point sqli_describe_input_stmt could not be located in the dynamic link isqlit09a.dll" Any ideas what's happening? Plat...
1
0
0
0
false
823,474
0
435
2
0
0
801,515
Does other way to connect to database work? Can you use (configure in control panel) ODBC? If ODBC works then you can use Python win32 extensions (ActiveState distribution comes with it) and there is ODBC support. You can also use Jython which can work with ODBC via JDBC-ODBC bridge or with Informix JDBC driver.
1
0
0
Why Python informixdb package is throwing an error!
2
python,informix
0
2009-04-29T09:01:00.000
I have downloaded & installed the latest Python InformixDB package, but when I try to import it from the shell, I am getting the following error in the form of a Windows dialog box! "A procedure entry point sqli_describe_input_stmt could not be located in the dynamic link isqlit09a.dll" Any ideas what's happening? Plat...
1
1
0.099668
0
false
803,958
0
435
2
0
0
801,515
Which version of IBM Informix Connect (I-Connect) or IBM Informix ClientSDK (CSDK) are you using? The 'describe input' function is a more recent addition, but it is likely that you have it. Have you been able to connect to any Informix DBMS from the command shell? If not, then the suspicion must be that you don't hav...
1
0
0
Why Python informixdb package is throwing an error!
2
python,informix
0
2009-04-29T09:01:00.000
I'm developing software using the Google App Engine. I have some considerations about the optimal design regarding the following issue: I need to create and save snapshots of some entities at regular intervals. In the conventional relational db world, I would create db jobs which would insert new summary records. For ...
1
3
0.197375
0
false
815,113
1
1,473
1
1
0
814,896
I think you'll find that snapshotting every user's state every hour isn't something that will scale well no matter what your framework. A more ordinary environment will disguise this by letting you have longer running tasks, but you'll still reach the point where it's not practical to take a snapshot of every user's da...
1
0
0
Google App Engine - design considerations about cron tasks
3
python,database,google-app-engine,cron
0
2009-05-02T13:54:00.000
So, I've been tossing this idea around in my head for a while now. At its core, it's mostly a project for me to learn programming. The idea is that, I have a large set of data, my music collection. There are quite a few datasets that my music has. Format, artist, title, album, genre, length, year of release, filena...
2
1
0.049958
0
false
818,763
0
2,085
1
0
0
818,752
Working on something you care about is the best way to learn programming, so I think this is a great idea. I also recommend Python as a place to start. Have fun!
1
0
0
Web-Based Music Library (programming concept)
4
php,python,mysql
0
2009-05-04T04:10:00.000
in my google app application, whenever a user purchases a number of contracts, these events are executed (simplified for clarity): user.cash is decreased user.contracts is increased by the number contracts.current_price is updated. market.no_of_transactions is increased by 1. in a rdms, these would be placed within t...
3
0
1.2
0
true
838,960
1
384
1
1
0
836,992
After a through research, I have found that a distributed transaction layer that provides a solution to the single entity group restriction has been developed in userland with the help of some google people. But so far, it is not released and is only available in java.
1
0
0
datastore transaction restrictions
3
python,google-app-engine,transactions,google-cloud-datastore
0
2009-05-07T20:55:00.000
Has anybody got recent experience with deploying a Django application with an SQL Server database back end? Our workplace is heavily invested in SQL Server and will not support Django if there isn't a sufficiently developed back end for it. I'm aware of mssql.django-pyodbc and django-mssql as unofficially supported bac...
52
4
0.113791
0
false
843,500
1
48,333
2
0
0
842,831
We are using django-mssql in production at our company. We too had an existing system using mssql. For me personally it was the best design decision I have ever made because my productivity increased dramatically now that I can use django . I submitted a patch but when I started using django-mssql and did a week or t...
1
0
0
Using Sql Server with Django in production
7
python,sql-server,django,pyodbc
0
2009-05-09T06:45:00.000
Has anybody got recent experience with deploying a Django application with an SQL Server database back end? Our workplace is heavily invested in SQL Server and will not support Django if there isn't a sufficiently developed back end for it. I'm aware of mssql.django-pyodbc and django-mssql as unofficially supported bac...
52
1
0.028564
0
false
843,476
1
48,333
2
0
0
842,831
Haven't used it in production yet, but my initial experiences with django-mssql have been pretty solid. All you need are the Python Win32 extensions and to get the sqlserver_ado module onto your Python path. From there, you just use sql_server.pyodbc as your DATABASE_ENGINE. So far I haven't noticed anything missing, b...
1
0
0
Using Sql Server with Django in production
7
python,sql-server,django,pyodbc
0
2009-05-09T06:45:00.000
I need to launch a server side process off a mysql row insert. I'd appreciate some feedback/suggestions. So far I can think of three options: 1st (least attractive): My preliminary understanding is that I can write a kind of "custom trigger" in C that could fire off a row insert. In addition to having to renew my C s...
3
4
0.379949
0
false
856,208
0
227
2
0
0
856,173
Write an insert trigger which duplicates inserted rows to a secondary table. Periodically poll the secondary table for rows with an external application/cronjob; if any rows are in the table, delete them and do your processing (or set a 'processing started' flag and only delete from the secondary table upon successful ...
1
0
0
launch a process off a mysql row insert
2
python,mysql,linux,perl
0
2009-05-13T05:15:00.000
I need to launch a server side process off a mysql row insert. I'd appreciate some feedback/suggestions. So far I can think of three options: 1st (least attractive): My preliminary understanding is that I can write a kind of "custom trigger" in C that could fire off a row insert. In addition to having to renew my C s...
3
0
0
0
false
856,210
0
227
2
0
0
856,173
I had this issue about 2 years ago in .NET and I went with the 3rd approach. However, looking back at it, I'm wondering if looking into Triggers with PhpMyAdmin & MySQL isn't the approach to look into.
1
0
0
launch a process off a mysql row insert
2
python,mysql,linux,perl
0
2009-05-13T05:15:00.000
I am writing a code in python in which I established a connection with database. I have queries in a loop. While queries being executed in the loop , If i unplug the network cable it should stop with an exception. But this not happens, When i again plug yhe network cabe after 2 minutes it starts again from where it end...
0
1
0.066568
0
false
867,433
0
442
2
0
0
867,175
If you want to implement timeouts that work no matter how the client library is connecting to the server, it's best to attempt the DB operations in a separate thread, or, better, a separate process, which a "monitor" thread/process can kill if needed; see the multiprocessing module in Python 2.6 standard library (there...
1
0
0
db connection in python
3
python,tcp,database-connection
0
2009-05-15T06:03:00.000
I am writing a code in python in which I established a connection with database. I have queries in a loop. While queries being executed in the loop , If i unplug the network cable it should stop with an exception. But this not happens, When i again plug yhe network cabe after 2 minutes it starts again from where it end...
0
2
0.132549
0
false
867,202
0
442
2
0
0
867,175
Your database connection will almost certainly be based on a TCP socket. TCP sockets will hang around for a long time retrying before failing and (in python) raising an exception. Not to mention and retries/automatic reconnection attempts in the database layer.
1
0
0
db connection in python
3
python,tcp,database-connection
0
2009-05-15T06:03:00.000
I am in the design phase of a file upload service that allows users to upload very large zip files to our server as well as updates our database with the data. Since the files are large (About 300mb) we want to allow the user to limit the amount of bandwidth they want to use for uploading. They should also be able to...
6
4
0.132549
0
false
878,154
0
3,014
3
0
0
878,143
What's wrong with FTP? The protocol supports reusability and there are lots and lots of clients.
1
0
0
Resumable File Upload
6
c#,java,python
0
2009-05-18T14:56:00.000
I am in the design phase of a file upload service that allows users to upload very large zip files to our server as well as updates our database with the data. Since the files are large (About 300mb) we want to allow the user to limit the amount of bandwidth they want to use for uploading. They should also be able to...
6
0
0
0
false
878,160
0
3,014
3
0
0
878,143
On client side, flash; On server side, whatever (it wouldn't make any difference). No existing technologies (except for using FTP or something).
1
0
0
Resumable File Upload
6
c#,java,python
0
2009-05-18T14:56:00.000
I am in the design phase of a file upload service that allows users to upload very large zip files to our server as well as updates our database with the data. Since the files are large (About 300mb) we want to allow the user to limit the amount of bandwidth they want to use for uploading. They should also be able to...
6
0
0
0
false
30,990,243
0
3,014
3
0
0
878,143
I'm surprised no one has mentioned torrent files. They can also be packaged into a script that then triggers something to execute.
1
0
0
Resumable File Upload
6
c#,java,python
0
2009-05-18T14:56:00.000
I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to ...
0
3
0.148885
0
false
890,202
1
967
4
0
0
881,517
For a user login and basic permission tokens in a simple web application I will definitely store that in a cookie-based session. It's true that a few SELECTs per request is not a big deal at all, but then again if you can get some/all of your web requests to execute from cached data with no DB hits at all, that just ...
1
0
0
SQLAlchemy - Database hits on every request?
4
python,sqlalchemy
0
2009-05-19T08:11:00.000
I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to ...
0
1
0.049958
0
false
881,535
1
967
4
0
0
881,517
It's a Database, so often it's fairly common to "hit" the Database to pull the required data. You can reduce single queries if you build up Joins or Stored Procedures.
1
0
0
SQLAlchemy - Database hits on every request?
4
python,sqlalchemy
0
2009-05-19T08:11:00.000
I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to ...
0
3
0.148885
0
false
882,021
1
967
4
0
0
881,517
"hitting the database for something like this on every request isn't efficient." False. And, you've assumed that there's no caching, which is also false. Most ORM layers are perfectly capable of caching rows, saving some DB queries. Most RDBMS's have extensive caching, resulting in remarkably fast responses to common ...
1
0
0
SQLAlchemy - Database hits on every request?
4
python,sqlalchemy
0
2009-05-19T08:11:00.000
I'm currently working with a web application written in Python (and using SQLAlchemy). In order to handle authentication, the app first checks for a user ID in the session, and providing it exists, pulls that whole user record out of the database and stores it for the rest of that request. Another query is also run to ...
0
2
0.099668
0
false
882,171
1
967
4
0
0
881,517
You are basically talking about caching data as a performance optimization. As always, premature optimization is a bad idea. It's hard to know where the bottlenecks are beforehand, even more so if the application domain is new to you. Optimization adds complexity and if you optimize the wrong things, you not only have ...
1
0
0
SQLAlchemy - Database hits on every request?
4
python,sqlalchemy
0
2009-05-19T08:11:00.000
MySQL has a RENAME TABLE statemnt that will allow you to change the name of a table. The manual mentions The rename operation is done atomically, which means that no other session can access any of the tables while the rename is running The manual does not (to my knowedge) state how this renaming is accomplishe...
3
5
1.2
0
true
885,783
0
2,472
1
0
0
885,771
I believe MySQL only needs to alter metadata and references to the table's old name in stored procedures -- the number of records in the table should be irrelevant.
1
0
0
How does MySQL's RENAME TABLE statment work/perform?
2
php,python,mysql,ruby,migration
0
2009-05-20T01:22:00.000
At start you have a string 'DDMMYYYY HHMMSS' and I want at the end to insert the string in a date field in sqlite3 database. The program is made in python. How can I do that ?
0
1
0.066568
0
false
890,025
0
359
1
0
0
889,974
Even though the ".schema" indicates that the field is a date or timestamp field... the field is actually a string. You can format the string anyway you want. If memory serves... their is no validation at all.
1
0
0
Is it possible to format a date with sqlite3?
3
python,sqlite,date
0
2009-05-20T20:08:00.000
I posted this in the mailing list, but the reply I got wasn't too clear, so maybe I'll have better luck here. I currently have a grid with data in it. I would like to know if there is a way to give each generated row an ID, or at least, associate each row with an object. It may make it more clear if I clarify what i'm ...
2
3
0.291313
0
false
901,806
0
1,026
1
0
0
901,704
What I did when I encountered such a case was to create a column for IDs and set its width to 0.
1
1
0
Give Wxwidget Grid rows an ID
2
python,wxpython,wxwidgets
0
2009-05-23T15:13:00.000
In diagnosing SQL query problems, it would sometimes be useful to be able to see the query string after parameters are interpolated into it, using MySQLdb's safe interpolation. Is there a way to get that information from either a MySQL exception object or from the connection object itself?
2
2
0.197375
0
false
904,077
0
817
1
0
0
904,042
Use mysql's own ability to log the queries and watch for them.
1
0
0
python-mysql : How to get interpolated query string?
2
python,mysql
0
2009-05-24T15:56:00.000
We have lots of data and some charts repesenting one logical item. Charts and data is stored in various files. As a result, most users can easily access and re-use the information in their applications. However, this not exactly a good way of storing data. Amongst other reasons, charts belong to some data, the charts a...
2
2
1.2
0
true
921,061
0
325
2
0
0
915,726
I can only agree with Reef on the general concepts he presented: You will almost certainly prefer the data in a database than in a single large file You should not worry that the data is not directly manipulated by users because as Reef mentioned, it can only go wrong. And you would be suprised at how ugly it can get ...
1
0
0
Reporting charts and data for MS-Office users
2
python,web-services,scripting,reporting,ms-office
0
2009-05-27T13:34:00.000
We have lots of data and some charts repesenting one logical item. Charts and data is stored in various files. As a result, most users can easily access and re-use the information in their applications. However, this not exactly a good way of storing data. Amongst other reasons, charts belong to some data, the charts a...
2
1
0.099668
0
false
920,669
0
325
2
0
0
915,726
Instead of using one big file, You should use a database. Yes, You can store various types of files like gifs in the database if You like to. The file would not be human readable or accessible by non-technical users, but this is good. The database would have a website that Your non-technical users would use to insert, ...
1
0
0
Reporting charts and data for MS-Office users
2
python,web-services,scripting,reporting,ms-office
0
2009-05-27T13:34:00.000
A table has been ETLed to another table. My task is to verify the data between two tables programmatically. One of the difficulties I m facing rite now is: how to use the expression that I can get from, let s say, derived column task and verify with the source and destination. or in other words, how can I use the expr...
0
2
0.379949
0
false
1,233,648
0
1,102
1
0
0
921,268
Set up a column which holds a CHECKSUM() of each row. Do a left outer join between the two tables . If you have any nulls for the right side, you have problems.
1
0
0
How to compare data of two tables transformed in SSIS package
1
.net,ssis,ironpython
0
2009-05-28T14:55:00.000
I am having a script which makes a db connection and pereform some select operation.accroding to the fetch data i am calling different functions which also perform db operations.How can i pass db connection to the functions which are being called as i donot want to make new connection
0
2
0.379949
0
false
934,709
0
515
1
0
0
934,221
Why to pass connection itself? Maybe build a class that handles all the DB-operation and just pass this class' instance around, calling it's methods to perform selects, inserts and all that DB-specific code?
1
0
0
python db connection
1
python
0
2009-06-01T10:08:00.000
It seems cx_Oracle doesn't. Any other suggestion for handling xml with Oracle and Python is appreciated. Thanks.
5
1
1.2
0
true
946,854
0
1,256
1
0
0
936,381
I managed to do this with cx_Oracle. I used the sys.xmltype.createxml() function in the statement that inserts the rows in a table with XMLTYPE fields; then I used prepare() and setinputsizes() to specify that the bind variables I used for XMLTYPE fields were of cx_Oracle.CLOB type.
1
0
0
Is there an Oracle wrapper for Python that supports xmltype columns?
3
python,xml,oracle,xmltype
0
2009-06-01T19:36:00.000
I'm trying to find a way to cause SQLAlchemy to generate a query of the following form: select * from t where (a,b) in ((a1,b1),(a2,b2)); Is this possible? If not, any suggestions on a way to emulate it?
10
3
1.2
0
true
951,640
0
6,490
1
0
0
948,212
Well, thanks to Hao Lian above, I came up with a functional if painful solution. Assume that we have a declarative-style mapped class, Clazz, and a list of tuples of compound primary key values, values (Edited to use a better (IMO) sql generation style): from sqlalchemy.sql.expression import text,bindparam ... def...
1
0
0
Sqlalchemy complex in_ clause with tuple in list of tuples
4
python,sql,sqlalchemy
0
2009-06-04T01:40:00.000
I have a webapp (call it myapp.com) that allows users to upload files. The webapp will be deployed on Amazon EC2 instance. I would like to serve these files back out to the webapp consumers via an s3 bucket based domain (i.e. uploads.myapp.com). When the user uploads the files, I can easily drop them in into a fold...
4
0
0
0
false
6,308,720
1
8,589
1
1
0
956,904
I'd suggest using a separately-mounted EBS volume. I tried doing the same thing for some movie files. Access to S3 was slow, and S3 has some limitations like not being able to rename files, no real directory structure, etc. You can set up EBS volumes in a RAID5 configuration and add space as you need it.
1
0
0
mounting an s3 bucket in ec2 and using transparently as a mnt point
5
python,django,amazon-s3,amazon-ec2
0
2009-06-05T16:39:00.000
I'm looking for resources to help migrate my design skills from traditional RDBMS data store over to AppEngine DataStore (ie: 'Soft Schema' style). I've seen several presentations and all touch on the the overarching themes and some specific techniques. I'm wondering if there's a place we could pool knowledge from exp...
6
1
0.049958
0
false
979,391
1
1,022
2
1
0
976,639
The non relational database design essentially involves denormalization wherever possible. Example: Since the BigTable doesnt provide enough aggregation features, the sum(cash) option that would be in the RDBMS world is not available. Instead it would have to be stored on the model and the model save method must be ove...
1
0
0
Thinking in AppEngine
4
java,python,google-app-engine,data-modeling
0
2009-06-10T16:13:00.000
I'm looking for resources to help migrate my design skills from traditional RDBMS data store over to AppEngine DataStore (ie: 'Soft Schema' style). I've seen several presentations and all touch on the the overarching themes and some specific techniques. I'm wondering if there's a place we could pool knowledge from exp...
6
1
0.049958
0
false
978,757
1
1,022
2
1
0
976,639
The timeouts are tight and performance was ok but not great, so I found myself using extra space to save time; for example I had a many-to-many relationship between trading cards and players, so I duplicated the information of who owns what: Card objects have a list of Players and Player objects have a list of Cards. N...
1
0
0
Thinking in AppEngine
4
java,python,google-app-engine,data-modeling
0
2009-06-10T16:13:00.000
I have a sqlite3 db which i insert/select from in python. The app works great but i want to tweak it so no one can read from the DB without a password. How can i do this in python? note i have no idea where to start.
10
3
0.119427
0
false
987,942
0
29,194
1
0
0
986,403
SQLite databases are pretty human-readable, and there isn't any built-in encryption. Are you concerned about someone accessing and reading the database files directly, or accessing them through your program? I'm assuming the former, because the latter isn't really database related--it's your application's security yo...
1
0
0
Encrypted file or db in python
5
python,sqlite,encryption
0
2009-06-12T12:35:00.000
A hashtable in memcached will be discarded either when it's Expired or when there's not enough memory and it's choosen to die based on the Least Recently Used algorithm. Can we put a Priority to hint or influence the LRU algorithm? I want to use memcached to store Web Sessions so i can use the cheap round-robin. I nee...
0
1
0.197375
0
false
1,130,289
0
799
1
0
0
1,000,540
Not that I know of. memcached is designed to be very fast and very straightforward, no fancy weights and priorities keep it simple. You should not rely on memcache for persistent session storage. You should keep your sessions in the DB, but you can cache them in memcache. This way you can enjoy both worlds.
1
0
0
Is there an option to configure a priority in memcached? (Similiar to Expiry)
1
python,database,session,caching,memcached
0
2009-06-16T09:56:00.000
I need your advices to choose a Python Web Framework for developing a large project: Database (Postgresql)will have at least 500 tables, most of them with a composite primary key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements a...
4
1
0.028564
0
false
2,246,687
1
2,101
4
0
0
1,003,131
I would absolutely recommend Repoze.bfg with SQLAlchemy for what you describe. I've done projects now in Django, TurboGears 1, TurboGears 2, Pylons, and dabbled in pure Zope3. BFG is far and away the framework most designed to accomodate a project growing in ways you don't anticipate at the beginning, but is far more l...
1
0
0
python web framework large project
7
python,frameworks,web-frameworks
0
2009-06-16T18:21:00.000
I need your advices to choose a Python Web Framework for developing a large project: Database (Postgresql)will have at least 500 tables, most of them with a composite primary key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements a...
4
2
0.057081
0
false
1,003,329
1
2,101
4
0
0
1,003,131
Depending on what you want to do, you actually have a few possible frameworks : [Django] Big, strong (to the limit of what a python framework can be), and the older in the race. Used by a few 'big' sites around the world ([Django sites]). Still is a bit of an overkill for almost everything and with a deprecated coding ...
1
0
0
python web framework large project
7
python,frameworks,web-frameworks
0
2009-06-16T18:21:00.000
I need your advices to choose a Python Web Framework for developing a large project: Database (Postgresql)will have at least 500 tables, most of them with a composite primary key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements a...
4
8
1
0
false
1,003,173
1
2,101
4
0
0
1,003,131
Yes. An ORM is essential for mapping SQL stuff to objects. You have three choices. Use someone else's ORM Roll your own. Try to execute low-level SQL queries and pick out the fields they want from the result set. This is -- actually -- a kind of ORM with the mappings scattered throughout the applications. It may ...
1
0
0
python web framework large project
7
python,frameworks,web-frameworks
0
2009-06-16T18:21:00.000
I need your advices to choose a Python Web Framework for developing a large project: Database (Postgresql)will have at least 500 tables, most of them with a composite primary key, lots of constraints, indexes & queries. About 1,500 views for starting. The project belongs to the financial area. Alwasy new requirements a...
4
12
1
0
false
1,003,161
1
2,101
4
0
0
1,003,131
Django has been used by many large organizations (Washington Post, etc.) and can connect with Postgresql easily enough. I use it fairly often and have had no trouble.
1
0
0
python web framework large project
7
python,frameworks,web-frameworks
0
2009-06-16T18:21:00.000
How can I configure Django with SQLAlchemy?
29
0
0
0
false
45,878,579
1
30,261
1
0
0
1,011,476
There are many benefits of using SQLAlchemy instead of Django ORM, but consider developing a built-in-Django choice of SQLAlchemy (to have something called a production ready) By the way, Django ORM is going better - in Django 1.11 they added UNION support (a SQL basic operator), so maybe some day there will be no need...
1
0
0
Configuring Django to use SQLAlchemy
5
python,django,sqlalchemy,configure
0
2009-06-18T08:31:00.000
This is mainly just a "check my understanding" type of question. Here's my understanding of CLOBs and BLOBs as they work in Oracle: CLOBs are for text like XML, JSON, etc. You should not assume what encoding the database will store it as (at least in an application) as it will be converted to whatever encoding the d...
39
56
1.2
0
true
1,018,096
0
43,567
2
0
0
1,018,073
CLOB is encoding and collation sensitive, BLOB is not. When you write into a CLOB using, say, CL8WIN1251, you write a 0xC0 (which is Cyrillic letter А). When you read data back using AL16UTF16, you get back 0x0410, which is a UTF16 represenation of this letter. If you were reading from a BLOB, you would get same 0xC0 b...
1
0
0
Help me understand the difference between CLOBs and BLOBs in Oracle
2
python,oracle
0
2009-06-19T13:51:00.000
This is mainly just a "check my understanding" type of question. Here's my understanding of CLOBs and BLOBs as they work in Oracle: CLOBs are for text like XML, JSON, etc. You should not assume what encoding the database will store it as (at least in an application) as it will be converted to whatever encoding the d...
39
10
1
0
false
1,018,102
0
43,567
2
0
0
1,018,073
Your understanding is correct. Since you mention Python, think of the Python 3 distinction between strings and bytes: CLOBs and BLOBs are quite analogous, with the extra issue that the encoding of CLOBs is not under your app's control.
1
0
0
Help me understand the difference between CLOBs and BLOBs in Oracle
2
python,oracle
0
2009-06-19T13:51:00.000
I have been building business database applications such as finance, inventory and other business requirement applications. I am planning to shift to Python. What would be the tools to start with best. I would need to do master, transaction forms, processing (back end), reports and that sort of thing. The database woul...
9
0
0
0
false
1,021,195
1
9,831
1
0
0
1,020,775
just FYI, for PyQT, the book has a chapter 15 with Databases, It looks good. and the book has something with data and view etc. I have read it and I think it's well worth your time:)
1
0
0
Python database application framework and tools
6
python,frame
0
2009-06-20T02:22:00.000
which versions of sqlite may best suite for python 2.6.2?
2
0
0
0
false
1,028,006
0
444
1
0
0
1,025,493
I'm using 3.4.0 out of inertia (it's what came with the Python 2.* versions I'm using) but there's no real reason (save powerful inertia;-) to avoid upgrading to 3.4.2, which fixes a couple of bugs that could lead to DB corruption and introduces no incompatibilities that I know of. (If you stick with 3.4.0 I'm told the...
1
0
0
sqlite version for python26
2
python,sqlite,python-2.6
0
2009-06-22T04:49:00.000
I'm using the above mentioned Python lib to connect to a MySQL server. So far I've worked locally and all worked fine, until i realized I'll have to use my program in a network where all access goes through a proxy. Does anyone now how I can set the connections managed by that lib to use a proxy? Alternatively: do you ...
2
1
0.066568
0
false
1,027,817
0
2,939
1
0
0
1,027,751
there are a lot of different possibilities here. the only way you're going to get a definitive answer is to talk to the person that runs the proxy. if this is a web app and the web server and the database serve are both on the other side of a proxy, then you won't need to connect to the mysql server at all since the we...
1
0
0
MySQLdb through proxy
3
python,mysql,proxy
0
2009-06-22T15:11:00.000
I am newbie in Google App Engine. While I was going through the tutorial, I found several things that we do in php-mysql is not available in GAE. For example in dataStore auto increment feature is not available. Also I am confused about session management in GAE. Over all I am confused and can not visualize the whole t...
17
1
0.066568
0
false
1,030,362
1
7,295
1
1
0
1,030,293
You don't write user management and registration and all that, because you use Google's own authentication services. This is all included in the App Engine documentation.
1
0
0
Simple User management example for Google App Engine?
3
php,python,google-app-engine
0
2009-06-23T01:58:00.000
I'm making a Django web-app which allows a user to build up a set of changes over a series of GETs/POSTs before committing them to the database (or reverting) with a final POST. I have to keep the updates isolated from any concurrent database users until they are confirmed (this is a configuration front-end), ruling ou...
8
2
0.132549
0
false
1,121,915
1
2,065
1
0
0
1,033,934
I came up with something similar to the Memento pattern, but different enough that I think it bears posting. When a user starts an editing session, I duplicate the target object to a temporary object in the database. All subsequent editing operations affect the duplicate. Instead of saving the object state in a meme...
1
0
0
Per-session transactions in Django
3
python,django,transactions
0
2009-06-23T17:16:00.000
I have a system sitting on a "Master Server", that is periodically transferring quite a few chunks of information from a MySQL DB to another server in the web. Both servers have a MySQL Server and an Apache running. I would like an easy-to-use solution for this. Currently I'm looking into: XMLRPC RestFul Services a si...
2
2
1.2
0
true
1,043,653
0
810
2
0
0
1,043,528
Server 1: Convert rows to JSON, call the RESTful api of second with JSON data Server 2: listens on a URI e.g. POST /data , get json data convert back to dictionary or ORM objects, insert into db sqlalchemy/sqlobject and simplejson is what you need.
1
0
0
Best Practise for transferring a MySQL table to another server?
5
python,web-services,database-design
0
2009-06-25T11:59:00.000
I have a system sitting on a "Master Server", that is periodically transferring quite a few chunks of information from a MySQL DB to another server in the web. Both servers have a MySQL Server and an Apache running. I would like an easy-to-use solution for this. Currently I'm looking into: XMLRPC RestFul Services a si...
2
0
0
0
false
1,043,595
0
810
2
0
0
1,043,528
Assuming your situation allows this security-wise, you forgot one transport mechanism: simply opening a mysql connection from one server to another. Me, I would start by thinking about one script that ran regularly on the write server and opens a read only db connection to the read server (A bit of added security) and ...
1
0
0
Best Practise for transferring a MySQL table to another server?
5
python,web-services,database-design
0
2009-06-25T11:59:00.000
I want to access a postgreSQL database that's running on a remote machine, from Python in OS/X. Do I have to install postgres on the mac as well? Or will psycopg2 work on its own. Any hints for a good installation guide for psycopg2 for os/x?
2
3
1.2
0
true
1,052,990
0
4,829
1
1
0
1,052,957
macports tells me that the psycopg2 package has a dependency on the postgres client and libraries (but not the db server). If you successfully installed psycopg, then you should be good to go. If you haven't installed yet, consider using macports or fink to deal with dependency resolution for you. In most cases, this w...
1
0
0
psycopg2 on OSX: do I have to install PostgreSQL too?
3
python,macos,postgresql
0
2009-06-27T14:52:00.000
I have a username which I must change in numerous (up to ~25) tables. (Yeah, I know.) An atomic transaction seems to be the way to go for this sort of thing. However, I do not know how to do this with pyodbc. I've seen various tutorials on atomic transactions before, but have never used them. The setup: Windows pla...
15
-10
-1
0
false
1,063,879
0
27,883
1
0
0
1,063,770
I don't think pyodbc has any specific support for transactions. You need to send the SQL command to start/commit/rollback transactions.
1
0
0
In Python, Using pyodbc, How Do You Perform Transactions?
2
python,transactions,pyodbc
0
2009-06-30T13:45:00.000
I am not very familiar with databases, and so I do not know how to partition a table using SQLAlchemy. Your help would be greatly appreciated.
2
3
0.197375
0
false
1,087,081
0
7,505
1
0
0
1,085,304
Automatic partitioning is a very database engine specific concept and SQLAlchemy doesn't provide any generic tools to manage partitioning. Mostly because it wouldn't provide anything really useful while being another API to learn. If you want to do database level partitioning then do the CREATE TABLE statements using c...
1
0
0
how to make table partitions?
3
python,sqlalchemy
0
2009-07-06T03:33:00.000
I want to write some unittests for an application that uses MySQL. However, I do not want to connect to a real mysql database, but rather to a temporary one that doesn't require any SQL server at all. Any library (I could not find anything on google)? Any design pattern? Note that DIP doesn't work since I will still ha...
8
12
1.2
0
true
1,088,090
0
3,416
1
0
0
1,088,077
There isn't a good way to do that. You want to run your queries against a real MySQL server, otherwise you don't know if they will work or not. However, that doesn't mean you have to run them against a production server. We have scripts that create a Unit Test database, and then tear it down once the unit tests have r...
1
0
0
testing python applications that use mysql
2
python,mysql,unit-testing
0
2009-07-06T17:00:00.000
I have id values for products that I need store. Right now they are all integers, but I'm not sure if the data provider in the future will introduce letters or symbols into that mix, so I'm debating whether to store it now as integer or string. Are there performance or other disadvantages to saving the values as string...
22
1
0.019997
0
false
1,090,708
0
10,684
8
0
0
1,090,022
You won't be able to do comparisons correctly. "... where x > 500" is not same as ".. where x > '500'" because "500" > "100000" Performance wise string it would be a hit especially if you use indexes as integer indexes are much faster than string indexes. On the other hand it really depends upon your situation. If you...
1
0
1
Drawbacks of storing an integer as a string in a database
10
python,mysql,database,database-design
0
2009-07-07T01:58:00.000
I have id values for products that I need store. Right now they are all integers, but I'm not sure if the data provider in the future will introduce letters or symbols into that mix, so I'm debating whether to store it now as integer or string. Are there performance or other disadvantages to saving the values as string...
22
0
0
0
false
1,090,924
0
10,684
8
0
0
1,090,022
Better use independent ID and add string ID if necessary: if there's a business indicator you need to include, why make it system ID? Main drawbacks: Integer operations and indexing always show better performance on large scales of data (more than 1k rows in a table, not to speak of connected tables) You'll have to ma...
1
0
1
Drawbacks of storing an integer as a string in a database
10
python,mysql,database,database-design
0
2009-07-07T01:58:00.000