Salvador Benimeli | 7 Sep 2010 19:49
Picon

cextensions compile issue on fedora core 13

Hello,


I'm trying to install storm 0.17 on fedora core 13. I'm using the easy_install utility but I get multiple compile errors on the cextensions file that I do know how the could be solved.


storm/cextensions.c:1910: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘primary_vars’
storm/cextensions.c: En el nivel principal:
storm/cextensions.c:1929: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
storm/cextensions.c:1937: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
storm/cextensions.c:1954: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
storm/cextensions.c:1971: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
storm/cextensions.c:1980: error: expected declaration specifiers or ‘...’ before ‘visitproc’
storm/cextensions.c: En la función ‘ObjectInfo_traverse’:
storm/cextensions.c:1982: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘__obj_ref’
storm/cextensions.c:1983: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘__obj_ref_callback’
storm/cextensions.c:1984: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘cls_info’
storm/cextensions.c:1985: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘event’
storm/cextensions.c:1986: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘variables’
storm/cextensions.c:1987: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘primary_vars’
storm/cextensions.c:1988: error: ‘PyDict_Type’ no se declaró aquí (primer uso en esta función)
storm/cextensions.c:1988: error: petición del miembro ‘tp_traverse’ en algo que no es una estructura o unión
storm/cextensions.c:1988: error: ‘PyObject’ no se declaró aquí (primer uso en esta función)
storm/cextensions.c:1988: error: expected expression before ‘)’ token
storm/cextensions.c:1988: error: operandos inválidos para el binario * (se tiene ‘char **’ y ‘char **’)
storm/cextensions.c:1988: error: el objeto ‘<erroneous-expression>’ llamado no es una función
storm/cextensions.c:1988: aviso: la devolución crea un entero desde un puntero sin una conversión
storm/cextensions.c: En la función ‘ObjectInfo_clear’:
storm/cextensions.c:1994: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘__obj_ref’
storm/cextensions.c:1995: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘__obj_ref_callback’
storm/cextensions.c:1996: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘cls_info’
storm/cextensions.c:1997: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘event’
storm/cextensions.c:1998: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘variables’
storm/cextensions.c:1999: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘primary_vars’
storm/cextensions.c:2000: error: ‘PyDict_Type’ no se declaró aquí (primer uso en esta función)
storm/cextensions.c:2000: error: petición del miembro ‘tp_clear’ en algo que no es una estructura o unión
storm/cextensions.c:2000: error: ‘PyObject’ no se declaró aquí (primer uso en esta función)
storm/cextensions.c:2000: error: expected expression before ‘)’ token
storm/cextensions.c:2000: error: operandos inválidos para el binario * (se tiene ‘char **’ y ‘char **’)
storm/cextensions.c:2000: error: el objeto ‘<erroneous-expression>’ llamado no es una función
storm/cextensions.c:2000: aviso: la devolución crea un entero desde un puntero sin una conversión
storm/cextensions.c: En el nivel principal:
storm/cextensions.c:2003: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
storm/cextensions.c: En la función ‘ObjectInfo_dealloc’:
storm/cextensions.c:2026: error: ‘ObjectInfoObject’ no tiene un miembro llamado ‘__weakreflist’
storm/cextensions.c:2027: error: ‘PyObject’ no se declaró aquí (primer uso en esta función)

Perhaps de gcc compiler version has something to see? I think all the required packages (gcc, g++, gmake...) are installed by default on fedora but I'm not really sure.

Anyone could help me, please?

Thanks in advance.

<div>
<p>Hello,</p>
<div><br></div>
<div>I'm trying to install storm 0.17 on fedora core 13. I'm using the easy_install utility but I get multiple compile errors on the cextensions file that I do know how the could be solved.</div>
<div><br></div>
<div><br></div>
<div>storm/cextensions.c:1910: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;primary_vars&rsquo;</div>
<div>storm/cextensions.c: En el nivel principal:</div>
<div>storm/cextensions.c:1929: error: expected &lsquo;=&rsquo;, &lsquo;,&rsquo;, &lsquo;;&rsquo;, &lsquo;asm&rsquo; or &lsquo;__attribute__&rsquo; before &lsquo;*&rsquo; token</div>
<div>storm/cextensions.c:1937: error: expected &lsquo;=&rsquo;, &lsquo;,&rsquo;, &lsquo;;&rsquo;, &lsquo;asm&rsquo; or &lsquo;__attribute__&rsquo; before &lsquo;*&rsquo; token</div>
<div>storm/cextensions.c:1954: error: expected &lsquo;=&rsquo;, &lsquo;,&rsquo;, &lsquo;;&rsquo;, &lsquo;asm&rsquo; or &lsquo;__attribute__&rsquo; before &lsquo;*&rsquo; token</div>
<div>
storm/cextensions.c:1971: error: expected &lsquo;=&rsquo;, &lsquo;,&rsquo;, &lsquo;;&rsquo;, &lsquo;asm&rsquo; or &lsquo;__attribute__&rsquo; before &lsquo;*&rsquo; token</div>
<div>storm/cextensions.c:1980: error: expected declaration specifiers or &lsquo;...&rsquo; before &lsquo;visitproc&rsquo;</div>
<div>storm/cextensions.c: En la funci&oacute;n &lsquo;ObjectInfo_traverse&rsquo;:</div>
<div>storm/cextensions.c:1982: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;__obj_ref&rsquo;</div>
<div>storm/cextensions.c:1983: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;__obj_ref_callback&rsquo;</div>
<div>storm/cextensions.c:1984: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;cls_info&rsquo;</div>
<div>storm/cextensions.c:1985: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;event&rsquo;</div>
<div>storm/cextensions.c:1986: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;variables&rsquo;</div>
<div>storm/cextensions.c:1987: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;primary_vars&rsquo;</div>
<div>storm/cextensions.c:1988: error: &lsquo;PyDict_Type&rsquo; no se declar&oacute; aqu&iacute; (primer uso en esta funci&oacute;n)</div>
<div>storm/cextensions.c:1988: error: petici&oacute;n del miembro &lsquo;tp_traverse&rsquo; en algo que no es una estructura o uni&oacute;n</div>
<div>storm/cextensions.c:1988: error: &lsquo;PyObject&rsquo; no se declar&oacute; aqu&iacute; (primer uso en esta funci&oacute;n)</div>
<div>storm/cextensions.c:1988: error: expected expression before &lsquo;)&rsquo; token</div>
<div>storm/cextensions.c:1988: error: operandos inv&aacute;lidos para el binario * (se tiene &lsquo;char **&rsquo; y &lsquo;char **&rsquo;)</div>
<div>storm/cextensions.c:1988: error: el objeto &lsquo;&lt;erroneous-expression&gt;&rsquo; llamado no es una funci&oacute;n</div>
<div>storm/cextensions.c:1988: aviso: la devoluci&oacute;n crea un entero desde un puntero sin una conversi&oacute;n</div>
<div>
storm/cextensions.c: En la funci&oacute;n &lsquo;ObjectInfo_clear&rsquo;:</div>
<div>storm/cextensions.c:1994: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;__obj_ref&rsquo;</div>
<div>storm/cextensions.c:1995: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;__obj_ref_callback&rsquo;</div>
<div>storm/cextensions.c:1996: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;cls_info&rsquo;</div>
<div>storm/cextensions.c:1997: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;event&rsquo;</div>
<div>storm/cextensions.c:1998: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;variables&rsquo;</div>
<div>storm/cextensions.c:1999: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;primary_vars&rsquo;</div>
<div>storm/cextensions.c:2000: error: &lsquo;PyDict_Type&rsquo; no se declar&oacute; aqu&iacute; (primer uso en esta funci&oacute;n)</div>
<div>storm/cextensions.c:2000: error: petici&oacute;n del miembro &lsquo;tp_clear&rsquo; en algo que no es una estructura o uni&oacute;n</div>
<div>storm/cextensions.c:2000: error: &lsquo;PyObject&rsquo; no se declar&oacute; aqu&iacute; (primer uso en esta funci&oacute;n)</div>
<div>storm/cextensions.c:2000: error: expected expression before &lsquo;)&rsquo; token</div>
<div>storm/cextensions.c:2000: error: operandos inv&aacute;lidos para el binario * (se tiene &lsquo;char **&rsquo; y &lsquo;char **&rsquo;)</div>
<div>storm/cextensions.c:2000: error: el objeto &lsquo;&lt;erroneous-expression&gt;&rsquo; llamado no es una funci&oacute;n</div>
<div>storm/cextensions.c:2000: aviso: la devoluci&oacute;n crea un entero desde un puntero sin una conversi&oacute;n</div>
<div>
storm/cextensions.c: En el nivel principal:</div>
<div>storm/cextensions.c:2003: error: expected &lsquo;=&rsquo;, &lsquo;,&rsquo;, &lsquo;;&rsquo;, &lsquo;asm&rsquo; or &lsquo;__attribute__&rsquo; before &lsquo;*&rsquo; token</div>
<div>storm/cextensions.c: En la funci&oacute;n &lsquo;ObjectInfo_dealloc&rsquo;:</div>
<div>storm/cextensions.c:2026: error: &lsquo;ObjectInfoObject&rsquo; no tiene un miembro llamado &lsquo;__weakreflist&rsquo;</div>
<div>storm/cextensions.c:2027: error: &lsquo;PyObject&rsquo; no se declar&oacute; aqu&iacute; (primer uso en esta funci&oacute;n)</div>
<div><br></div>
<div>Perhaps de gcc compiler version has something to see? I think all the required packages (gcc, g++, gmake...) are installed by default on fedora but I'm not really sure.</div>
<div><br></div>
<div>Anyone could help me, please?</div>
<div><br></div>
<div>Thanks in advance.</div>
<div><br></div>
</div>
Gavin Panella | 17 Sep 2010 12:38
Favicon
Gravatar

How to express DISTINCT ON for PostgreSQL.

Hi,

How can I express the following query with Storm:

  SELECT DISTINCT ON (assignee) task.* FROM task
   ORDER BY assignee, date_created

(Get the oldest task for each assignee.)

I can do something like:

  columns = SQL("DISTINCT ON (assignee) assignee"), Task
  ordering = Task.assignee, Task.date_created
  results = store.find(columns).order_by(ordering)

However, list(results) comes out with something like:

  [(1, <Task object at ...>),
   (2, <Task object at ...>)]

I'd like to be able to not select the assignee column separately, and
I'd like to avoid using SQL() if possible.

Thanks, Gavin.

Gavin Panella | 17 Sep 2010 18:28
Favicon
Gravatar

Re: How to express DISTINCT ON for PostgreSQL.

I've just been told by Abel that this is already reported as bug
374777 <https://bugs.launchpad.net/storm/+bug/374777>.

Shaun McCance | 20 Sep 2010 16:11
Picon
Gravatar

Return subselect results

Hi folks,

I'm trying to figure out how to return the result of a
subselect in a ResultSet. The Storm tutorial shows how
to use a subselect for an IS IN expression. I want to
return the result of a SELECT COUNT(*). Here's the SQL:

select Branch.ident,
  (select count(*) from Branch as Translation
    where Translation.type = "Translation"
    and Translation.parent_ident = Branch.ident)
  from Branch
  join SetModule on SetModule.pred_ident = Branch.parent_ident
  where SetModule.subj_ident = "/set/gnome-3-0-desktop"
  and Branch.type = "Document";

This SQL works fine, and returns the expected results.
Here's what I naively expected would work in Storm:

Translation = ClassAlias(Branch)
tables = store.using(Branch,
  Join(SetModule, SetModule.pred_ident == Branch.parent_ident))
tables.find((Branch.ident,
             Select(Count(Translation.ident),
               where=And(Translation.parent_ident == Branch.ident,
                         Translation.type == u'Translation'),
               tables=Translation)),
  SetModule.subj_ident == u'/set/gnome-3-0-desktop',
  Branch.type == u'Document')

But the resultant SQL looks like this:

SELECT Branch.ident, SELECT COUNT(`_1`.ident) FROM ...

It's very nearly correct, except the subselect needs
to have parentheses around it. I also tried this, at
the suggestion from somebody on IRC:

tables.find((Branch.ident,
             Count(Select(Translation.ident, ...)),
  ...)

The resultant SQL:

SELECT Branch.ident, COUNT((SELECT `_1`.ident FROM ...

This always returns nothing in Storm. If I run the SQL
Storm generates myself in MySQL, I get this:

ERROR 1242 (21000): Subquery returns more than 1 row

The first approach is what I think ought to work, and
it comes very close to working, in terms of the SQL it
generates. (I have no idea how much more effort it is
to figure out how to marshal that back into something
Pythonic in Storm.)

I found a similar problem on the mailing list in 2009.
I have something that works, thanks to James:

tables = store.using(Branch,
  Join(SetModule, SetModule.pred_ident == Branch.parent_ident),
  LeftJoin(Translation,
    Translation.parent_ident = Branch.ident,
    Translation.type == u'Translation'
  ))
tables.find((Branch.ident, Count(translation.ident)),
  SetModule.subj_ident == u'/set/gnome-3-0-desktop',
  Branch.type == u'Document'
).group_by(Branch.ident)

Same results, but a very different approach in terms
of the generated SQL. My tests against my database
show this approach to be about 60% slower than the
subselect approach.

So what are my options? Is the subselect approach
something that could work in Storm?

--

-- 
Shaun McCance
http://syllogist.net/

Edoardo Serra | 27 Sep 2010 18:07
Picon
Gravatar

Problem with EXISTS clause

Hi guys,
	I have some problems in building a query using the EXISTS clause.

I have two tables:

CREATE TABLE accounts (
    id serial NOT NULL,
    legal_name character varying(255) NOT NULL,
    address_1 character varying(255),
    ...
);

CREATE TABLE subscriptions (
    id serial NOT NULL,
    account_id integer NOT NULL,
    date_start date NOT NULL,
    ...
);

I would like to know how many accounts are not subscribed to any service.

The SQL query to get that should be:

SELECT COUNT(*) FROM accounts WHERE NOT EXISTS (SELECT * FROM subscriptions WHERE
subscriptions.account_id = accounts.id)

I tried the following python code

accounts = store.find(Account,
    SQL.Not(SQL.Exists(SQL.Select(Subscription.id,
        Subscription.account_id==Account.id)))).count()

but it gets translated to the following SQL:

SELECT COUNT(*) FROM accounts WHERE NOT EXISTS (SELECT subscriptions.id FROM accounts, subscriptions
WHERE subscriptions.account_id = accounts.id)

which does not give me the expected result, the accounts table should be removed from the FROM clause in the subquery.

Any suggestion?

I'm using Storm 0.17.0.99, I could upgrade if necessary, but I did not find anything relevant in the changelog.
My database server is PostgreSQL 8.3.11.

Tnx in advance

Edoardo Serra

Jamu Kakar | 27 Sep 2010 22:59
Picon
Gravatar

Re: Problem with EXISTS clause

Hi Edoardo,

On Mon, Sep 27, 2010 at 6:07 PM, Edoardo Serra <edoardo <at> serra.to.it> wrote:
> I tried the following python code
>
> accounts = store.find(Account,
>    SQL.Not(SQL.Exists(SQL.Select(Subscription.id,
>        Subscription.account_id==Account.id)))).count()
>
> but it gets translated to the following SQL:
>
> SELECT COUNT(*) FROM accounts WHERE NOT EXISTS (SELECT subscriptions.id FROM accounts, subscriptions
WHERE subscriptions.account_id = accounts.id)
>
> which does not give me the expected result, the accounts table should be removed from the FROM clause in the subquery.
>
> Any suggestion?

I believe you need to pass an explicit list of tables to the Select
expression, to override the logic that automatically determines
which tables to include in the FROM clause:

subselect = Select(Subscription.id,
                   Subscription.account_id == Account.id,
                   [Subscription])
accounts = store.find(Account, Not(Exists(subselect))).count()

Thanks,
J.

--

-- 
storm mailing list
storm <at> lists.canonical.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
Edoardo Serra | 27 Sep 2010 23:07
Picon
Gravatar

Re: Problem with EXISTS clause

Hi Jamu,

On Sep 27, 2010, at 10:59 PM, Jamu Kakar wrote:

> I believe you need to pass an explicit list of tables to the Select
> expression, to override the logic that automatically determines
> which tables to include in the FROM clause:
> 
> subselect = Select(Subscription.id,
>                   Subscription.account_id == Account.id,
>                   [Subscription])
> accounts = store.find(Account, Not(Exists(subselect))).count()

Thanks to you and Jürgen, I did not know this feature!

E.

--

-- 
storm mailing list
storm@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm

James Henstridge | 1 Oct 2010 05:59
Picon
Gravatar

Re: Return subselect results

On Mon, Sep 20, 2010 at 10:11 PM, Shaun McCance <shaunm@...> wrote:
> Hi folks,
>
> I'm trying to figure out how to return the result of a
> subselect in a ResultSet. The Storm tutorial shows how
> to use a subselect for an IS IN expression. I want to
> return the result of a SELECT COUNT(*). Here's the SQL:
>
> select Branch.ident,
>  (select count(*) from Branch as Translation
>    where Translation.type = "Translation"
>    and Translation.parent_ident = Branch.ident)
>  from Branch
>  join SetModule on SetModule.pred_ident = Branch.parent_ident
>  where SetModule.subj_ident = "/set/gnome-3-0-desktop"
>  and Branch.type = "Document";
>
> This SQL works fine, and returns the expected results.
> Here's what I naively expected would work in Storm:
>
> Translation = ClassAlias(Branch)
> tables = store.using(Branch,
>  Join(SetModule, SetModule.pred_ident == Branch.parent_ident))
> tables.find((Branch.ident,
>             Select(Count(Translation.ident),
>               where=And(Translation.parent_ident == Branch.ident,
>                         Translation.type == u'Translation'),
>               tables=Translation)),
>  SetModule.subj_ident == u'/set/gnome-3-0-desktop',
>  Branch.type == u'Document')
>
> But the resultant SQL looks like this:
>
> SELECT Branch.ident, SELECT COUNT(`_1`.ident) FROM ...
>
> It's very nearly correct, except the subselect needs
> to have parentheses around it. I also tried this, at
> the suggestion from somebody on IRC:
>
> tables.find((Branch.ident,
>             Count(Select(Translation.ident, ...)),
>  ...)
>
> The resultant SQL:
>
> SELECT Branch.ident, COUNT((SELECT `_1`.ident FROM ...
>
> This always returns nothing in Storm. If I run the SQL
> Storm generates myself in MySQL, I get this:
>
> ERROR 1242 (21000): Subquery returns more than 1 row
>
> The first approach is what I think ought to work, and
> it comes very close to working, in terms of the SQL it
> generates. (I have no idea how much more effort it is
> to figure out how to marshal that back into something
> Pythonic in Storm.)
>
> I found a similar problem on the mailing list in 2009.
> I have something that works, thanks to James:
>
> tables = store.using(Branch,
>  Join(SetModule, SetModule.pred_ident == Branch.parent_ident),
>  LeftJoin(Translation,
>    Translation.parent_ident = Branch.ident,
>    Translation.type == u'Translation'
>  ))
> tables.find((Branch.ident, Count(translation.ident)),
>  SetModule.subj_ident == u'/set/gnome-3-0-desktop',
>  Branch.type == u'Document'
> ).group_by(Branch.ident)
>
> Same results, but a very different approach in terms
> of the generated SQL. My tests against my database
> show this approach to be about 60% slower than the
> subselect approach.
>
> So what are my options? Is the subselect approach
> something that could work in Storm?

Sorry for not getting round to replying to this.  This looks like a
bug in Storm's expression compiler.  It looks like it needs to adjust
the precedence level when compiling the column list for the Select
object so that parentheses are added.

Try modifying compile_select() in storm/expr.py and add
"state.precedence += 0.5" on the line before it compiles
select.columns, and then reduce it again afterwards.

James.

--

-- 
storm mailing list
storm@...
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm


Gmane