I'm trying to create a mixin that will setup FK columns that are
dynamically named based on the name of the parent as opposed to a static
name like `parent_id`. If was going to do the latter, I could easily use
`declarted_attr` but since I want the former, I thought I could use
`__declare_firs
Is there any way to get relationship joined loading to work from child back
up to the parent?
from sqlalchemy import create_engine, Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
engine = create_en
my thought is, if we don't bring anything to the table that pyodbc
doesn't bring, then why shouldn't we point people in that direction instead.
However, I appreciate your input here and on the GH issue that pymssql
is more stable than pyodbc. That is exactly the kind of inf
There is a proposal open to discontinue pymssql development and point
people towards pyodbc. Since pymssql is a documented backend for SA, I
figured there might be some people here who are interested.
If you have any skin in that game and want to comment, please visit the
issue: https://github
Mike,
Just to be clear, I'm not doing any kind of selects. I'm only inserting
records. And these aren't large binary blobs of any kind, they are
rather small strings and ints.
I apologize in advance if I misunderstood your answer.
*Randy Syring*
Chief Executive D
I'm working on a project to parse through a large text file (1GB) of
records. Once parsed, each record gets sent to the DB. Due to the size of
the file, I've been working on a streaming/functional approach that will
keep my memory usage constant.
I've been able to simply take the DB out of
So helpful! Thanks.
*Randy Syring*
Chief Executive Developer
Direct: 502.276.0459
Office: 812.285.8766
Level 12 <https://www.level12.io/>
On 07/24/2015 03:45 PM, Mike Bayer wrote:
On 7/24/15 3:17 PM, Randy Syring wrote:
I have some generic timestamp columns as part of a mixin. I&
I have some generic timestamp columns as part of a mixin. I'd like for
these columns to have server defaults of the current UTC time. If I wanted
local time, I could just do:
created_ts = Column(DateTime, ...,
server_default=sasql.text('CURRENT_TIMESTAMP'))
The problem I'm running into is th
I am trying to get SQLAlchemy to let my database's foreign keys "on delete
cascade" do the cleanup on the association table between two objects. I
have setup the cascade and passive_delete options on the relationship as
seems appropriate from the docs. However, when a related object is loaded
i
I added the new recipe to the wiki.
-
Randy Syring
Development& Executive Director
Level 12 Technologies <https://www.lev12.com/> (formerly Intelicom)
Direct: 502-276-0459
Office: 502-212-9913
Intelicom is now Level 12 Technologies,learn
T ? OFFSET ?
However, I was mistaken in my original post. The problem was not with
the helper function but with the way I was doing my testing. The full
implementation of the helper function is here:
http://stackoverflow.com/a/5698357/182111
-----
Ra
Excellent, thank you!
-
Randy Syring
Development& Executive Director
Level 12 Technologies <https://www.lev12.com/> (formerly Intelicom)
Direct: 502-276-0459
Office: 502-212-9913
Intelicom is now Level 12 Technologies,learn more abou
I found a recipe on stackoverflow for turning a query instance into a
string, including parameters. I only do this for testing purposes and the
implementation is here:
https://bitbucket.org/rsyring/sqlalchemybwc/src/292597b37736/sqlalchemybwc/lib/testing.py
However, I just upgraded to 0.7.5 an
FWIW, I tried the map_to() method but still received the PK error.
The following method, however, worked fine:
ss = SqlSoup(db.engine)
meta = ss._metadata
tbl_vrmf = sa.Table("vRMF", meta, autoload=True)
vrmf_pks = [tbl_vrmf.c.dateId, tbl_vrmf.c.ident, tbl_vrmf.c.mnum]
vrmf = ss.map(tbl_vrmf, prim
If anyone is interested, I have some code that writes basic details for
tables, constraints, indexes, and triggers out to files. Code is here:
https://bitbucket.org/rsyring/mssqlddlwriter/
--
Randy Syring
Intelicom
Direct: 502-276-0459
Office: 502-212-9913
That was it, thanks. I was trying to go through the column and looking
at it's foreign_keys collection. When I set those values, it didn't
affect the output. Reflects my ignorance of SA, obviously.
Thanks again.
------
Randy Syring
Intelicom
Direc
he "mock" executor as in the second example
> here:http://www.sqlalchemy.org/trac/wiki/FAQ#HowcanIgettheCREATETABLEDROPT...
>
> On Jun 1, 2011, at 8:01 PM, Randy Syring wrote:
>
>
>
>
>
>
>
> > I'd like to be able to dump an MS SQL server'
In the FAQ...sorry:
http://www.sqlalchemy.org/trac/wiki/FAQ#HowcanIgettheCREATETABLEDROPTABLEoutputasastring
On Jun 1, 8:01 pm, Randy Syring wrote:
> I'd like to be able to dump an MS SQL server's objects to text on the
> local file system. I have a working solution f
I'd like to be able to dump an MS SQL server's objects to text on the
local file system. I have a working solution for views, stored
procedures, and functions, but tables are a different story. Can i
use SA's reflection and table creation abilities to write create table
DDL to a text file?
--
Y
Seems to be a unicode conversion problem, if you are interested in
following, the pyodbc issue with very small test case is here:
http://code.google.com/p/pyodbc/issues/detail?id=170
On Apr 7, 9:37 am, Michael Bayer wrote:
> On Apr 7, 2011, at 12:46 AM, Randy Syring wrote:
>
> >
I am running Ubuntu 10.04, python 2.6.5, SA 0.6.6, latest pyodbc
release. I have tried FreeTDS that ships with the distro (0.82) as
well as current CVS. I can make a connection and issue a basic SQL
statement. However, when I try to run my unit tests, I get the
following error:
*** glibc detect
Thank you! Ticket for doc addition: http://www.sqlalchemy.org/trac/ticket/1994
On Dec 6, 6:10 pm, Michael Bayer wrote:
> specify implicit_returning = False as part of the Table arguments. Should
> probably add a note to the MSSQL docs on this.
>
> On Dec 6, 2010, at 5:41 PM,
I am executing a bulk insert which is resulting in SQL like:
INSERT INTO equipment (equipment_type_id, number, mark, inactive)
OUTPUT inserted.id VALUES (?, ?, ?, ?)' (6, u'1', None, 0)
But I have a trigger on equipment that does some validity checking.
When executing, I get an exception whic
I wanted to let others know about a project I am working on to give
active record style validations to declarative SA classes. The idea
is that you can declare validation on individual fields or the whole
class and have those validators fire when the session is flushed.
I am not an SA guru by any
http://www.sqlalchemy.org/docs/reference/ext/declarative.html#controlling-table-inheritance-with-mixins
In the second example, Engineer has "__tablename__ = None"
But, I think the point of that section, is that it wouldn't be
needed. __tablename__ in Tablename should assign None anyway,
shouldn't
I have been, naively it seems, using multiple declarative Base classes
in my webapp. They all share the same metadata object.
I have found one negative ramification of this, which is that string
references (like what can be used in relation()) won't find the object
if they are not using the same
int either.
------
Randy Syring
Intelicom
502-644-4776
"Whether, then, you eat or drink or
whatever you do, do all to the glory
of God." 1 Cor 10:31
Randy Syring wrote:
Mike,
Thank you for your quick reply.
If I understand correctly, after_flush() will get
. NULL in non-NULL
fields, string lengths greater than the column size).
However, I can do some testing with it.
On Apr 19, 3:31 pm, Michael Bayer wrote:
> On Apr 19, 2010, at 3:25 PM, Randy Syring wrote:
>
>
>
>
>
> > * I would like default values to have been ap
I am developing a library to do Active Record style validations on SA
declarative instances:
http://bitbucket.org/rsyring/sqlalchemy-validation/src/tip/savalidation/
I know there are differences of opinion on the value of doing
validation like this, but I am really hoping to avoid that discussion
I am creating a web application that has the concept of organizations
and people. I would like the end users to be able to define custom
fields on those objects as needed. So,
User A (only default fields):
Organization:
- Name
- Zip
People:
- Name
- Phone Number
User B (has a few custom field
Can anyone give me an idea of what I need to do here? If I can just
get a high level overview of what I need to do, I am happy to read the
documentation and source to fill in the details.
Thanks.
On Oct 1, 1:56 pm, Randy Syring wrote:
> Mike,
>
> Thank you for the prompt reply:
>
Mike,
Thank you for the prompt reply:
On Oct 1, 1:11 pm, "Michael Bayer" wrote:
> Randy Syring wrote:
>
> I'm not sure of the context here. are you generating code or just
> executing SQL ?
Ok, maybe a small example. Here is a declarative object and the ho
I am trying to write a datagrid library for sqlalchemy which will
allow easy generation of tables from SA objects. I would like the
datagrid to be able to accept a table column, declarative attribute,
or elixir entity attribute interchangeably. Since I am building the
SQL with queries, this has
Mike,
Thank you for the reply. That looks very close to what I have. At the very
least, my understanding about what I should be able to do looks correct. I
will do some further testing and examination and post back with details.
Thanks again.
--
Randy
I have a case(...) that looks right when I print it and am now trying
to use it in a filter, something like:
sess.query(User).select_from(join(...)).filter(case(...) == 1)
But I get an error. When dissecting the parts, the problem is coming
from the "case(...) == 1" part. Can someone tell me h
On Jul 23, 5:04 am, "King Simon-NFHD78"
wrote:
> When I run your script, I get the correct output, using Python 2.5.1, SA
> 0.5.4p2, sqlite3 version 2.3.2. Perhaps the bug is in the version of
> SQLite that you are using?
>
> What happens if you run your query using the SQLite command-line tools?
On Jul 22, 9:02 pm, Michael Bayer wrote:
> On Jul 22, 2009, at 8:48 PM, Randy Syring wrote:
> well this is really easy to analyze, turn on echo=debug and see what
> SQLite is returning. The mapping of SQLite names to SQLA column types
> in the 0.5 series is in sqlalchemy/databases/
I work with the OP. The columns are correctly typed and the
reflection code seems to work correctly with views that are directly
selecting from tables. Its when a view selects from another view that
we have problems with the type being lost.
Can anyone else say for sure whether it is supported
Darn! I thought I checked that. But you are right. Thank you for
the post!
On Jun 1, 3:55 pm, mtrier wrote:
> Looks like you're using 0.5.3 I believe which had problems with this.
> Upgrade to a later release.
>
> Thanks,
>
> Michael
--~--~-~--~~~---~--~~
You
pm, Randy Syring wrote:
> I made a post on Friday about some issues I was having with pyodbc and
> mssql. Now I can't find it. I feel like I am losing my mind. Does
> anyone remember seeing that post? I have tried just about every
> search combination I can think of and ca
I made a post on Friday about some issues I was having with pyodbc and
mssql. Now I can't find it. I feel like I am losing my mind. Does
anyone remember seeing that post? I have tried just about every
search combination I can think of and can't find the post anywhere.
Thanks.
--~--~-~
embedded system, probably all resources are pretty
> severely restricted.
> --
> Mike Conley
>
> On Fri, May 29, 2009 at 9:44 AM, Randy Syring wrote:
>
> > Mike,
>
> > Well...I am not sure. I thought SQLite held transaction details in
> > a .journal file an
till be true with
> triggers? After all, if the problem is that the transaction is too big, it
> will still be too big with all the pending deletes executed in a trigger.
>
> --
> Mike Conley
>
> On Fri, May 29, 2009 at 8:47 AM, Randy Syring wrote:
>
> > Another solu
Another solution is to use triggers in SQLite to enforce FK
relationships.
http://www.sqlite.org/cvstrac/wiki?p=ForeignKeyTriggers
http://code.google.com/p/sqlitefktg4sa/
On May 29, 6:59 am, Mike Conley wrote:
> One solution is to change the commit strategy; issue commits periodically
> during
I have been having a weird thing happen when using pyodbc with mssql.
The create table statements work, but none of the INSERT statements
do. For example, when I run code and echo, I get this:
(TCSData) F:\Inetpub\TCSData\src\tcsdata-dist\tcsdata>pysmvt broadcast
initapp
calling: action_pysapp_i
I have searched the list and have seen some examples with Oracle and I
have seen some examples with MSSQL using 'exec' but without
parameters. So, I was hoping that someone could give me or point me
to an example of using a MSSQL stored procedure with both input and
output parameters as well as t
Michael,
Thanks for your reply.
On Apr 1, 11:46 am, "Michael Bayer" wrote:
> there's a nested set demo in the examples/ folder of the distribution,
> which uses MapperExtension as well as a little-used flag on the mapper
> called "batch=False". are you building off of that ?
No, I had wrot
I have a nested set implementation that I am working on. Currently,
the steps involved to make a change to the table are:
1) Retrieve parent node (ORM Object)
2) Create new node (same ORM object as #1)
3) Calculate UPDATE boundaries, etc. from anchor node
4) Create UPDATE SQL based on #3
5) Exec
Problem turns out to have been with my ISAPI WSGI interface, it looks
like it has a broken thread local model. More details here if anyone
is interested:
http://groups.google.com/group/sqlalchemy/browse_thread/thread/fbca1399020f6a2e
On Nov 6, 5:19 pm, Randy Syring <[EMAIL PROTECTED]>
On Nov 16, 11:30 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
>
> I've looked into PyISAPIe. Suffice to say this seems to be an
> extremely new project. Their homepage is blank:
It has been around for a couple years:
http://web.archive.org/web/*/http://pyisapie.sourceforge.net/
But I agr
On Nov 15, 6:39 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
Thank you so much for your response, I am extremely grateful.
However, I am still getting exceptions thrown from SQLite for sharing
connections across threads.
> The explicit connection as well as the "threadlocal" strategy are all
>
As noted here, I have been having some problems with SQLite
connections:
http://groups.google.com/group/sqlalchemy/browse_thread/thread/5f742fdd313f3da9/
I went ahead and produced what I hope is a very narrow test case to
show that I am not explicitly holding onto connections (unless I
completel
Thank you for taking the time to respond, I really appreciate it!
On Nov 6, 2:46 pm, Michael Bayer <[EMAIL PROTECTED]> wrote:
> you should definitely create the engine and metadata on a per-process
> basis. When using SQLite, the engine automatically chooses the
> "SingletonThreadPool" con
I am developing a WSGI based web framework with sqlalchemy. I am
unclear about when create_engine() should be called. I initially
thought that engine creation and metadata would be initialized per
process and each thread/request would just get a new session.
However, I have recently run into err
After some work with Gedd on #sqlalchemy, it seems that adding
children to a parent object using a custom property() doesn't work as
we expected it would. A test case is here:
http://paste.pocoo.org/show/86848/
The error is triggered by line #53.
Are we doing something wrong or is this a bug i
Simon,
THANK YOU!! Yes, I believe that will do it.
On Sep 30, 5:12 am, "King Simon-NFHD78" <[EMAIL PROTECTED]>
wrote:
> > -Original Message-
> > From: sqlalchemy@googlegroups.com
> > [mailto:[EMAIL PROTECTED] On Behalf Of Randy Syring
> &
0, 2:14 am, Randy Syring <[EMAIL PROTECTED]> wrote:
> More details are
> here:http://groups.google.com/group/sqlelixir/browse_thread/thread/aac5d22...
>
> But basically, I have a relationship between a parent (Item) table and
> child (Link) table. When I try to delete an Item,
More details are here:
http://groups.google.com/group/sqlelixir/browse_thread/thread/aac5d22702e3a8ec
But basically, I have a relationship between a parent (Item) table and
child (Link) table. When I try to delete an Item, an SQL statement is
generated by SQLAlchemy that tries to set Link.item_
Has anyone written or seen something that would take an SQLAlchemy
query, any query, and turn the resulting recordset into an HTML
table? Bonus points for providing a sort, filter, and paging feature.
Thanks.
--~--~-~--~~~---~--~~
You received this message because
Gaëtan,
Thank you.
On Aug 27, 5:23 am, "Gaetan de Menten" <[EMAIL PROTECTED]> wrote:
> On Wed, Aug 27, 2008 at 3:21 AM, Randy Syring <[EMAIL PROTECTED]> wrote:
>
> > Ok, so I was going to try and implement a solution using the method
> > discussed her
same function if you like- the event name will
> be passed in as the first argument.
>
> Randy Syring wrote:
> > Jason,
>
> > Thank you for the response. Using the method you suggest, am I
> > understanding correctly that fks_for_sqlite() would only be run when a
>
, jason kirtland <[EMAIL PROTECTED]> wrote:
> Yep, though possibly you'd want it on before-drop. You can actually
> handle both tasks in the same function if you like- the event name will
> be passed in as the first argument.
>
> Randy Syring wrote:
> > Jason,
>
>
>http://www.sqlalchemy.org/docs/05/sqlalchemy_schema.html#docstrings_s...
>
> > the ForeignKey objects on the table can be pulled out using:
>
> > for c in table.c:
> > for fk in c.foreign_keys:
> > do_something_with_fk(fk)
>
> > On Aug
oreignKey objects on the table can be pulled out using:
>
> for c in table.c:
> for fk in c.foreign_keys:
> do_something_with_fk(fk)
>
> On Aug 22, 2008, at 11:19 AM, Randy Syring wrote:
>
>
>
> > I would like sqlalchemy to generate
I would like sqlalchemy to generate triggers on an SQLite database to
enforce foreign key relationships. The method is documented here:
http://www.sqlite.org/cvstrac/wiki?p=ForeignKeyTriggers
and I have written a foreign key trigger generator here:
http://rcs-comp.com/site/index.php/view/Utili
65 matches
Mail list logo