These are chat archives for fossasia/open-event-server

16th
Jun 2017
Afroz Ahamad
@enigmaeth
Jun 16 2017 05:56
@mariobehling Sorry if you have felt so, but I have made several PRs for the new APIs which got merged. Anyways you can see an increase in contributions from my side. :smile:
Mario Behling
@mariobehling
Jun 16 2017 09:08
:+1:
Areeb Jamal
@iamareebjamal
Jun 16 2017 12:39
@niranjan94 The nextgen API format soec has 2 types of time
2017-05-31T18:30:00+00:00
and
2017-06-11T07:26:41.852285+00:00
Which one will be final, or we'll have to support both?
Niranjan Rajendran
@niranjan94
Jun 16 2017 18:00
@iamareebjamal both are the same.
One has a decimal place for seconds and one doesn't
As far as parsing is concerned .. Both are the same date format type.
And valid ISO-8601 timezone-aware datetime string
Areeb Jamal
@iamareebjamal
Jun 16 2017 18:01
Java date format gives error for such different type of dates. I'll look for the workarounds. Thanks :smile:
Niranjan Rajendran
@niranjan94
Jun 16 2017 18:02
Cool thanks :)
Aseem Shrey
@LuD1161
Jun 16 2017 18:12

The problem is speaker model doesn't have an attribute called sessions but it has a backref in session model.

But implementing it gives an error.

{
    "errors": [
        {
            "status": 500,
            "source": "",
            "detail": "'AppenderBaseQuery' object has no attribute 'id'",
            "title": "Unknown error"
        }
    ],
    "jsonapi": {
        "version": "1.0"
    }
}

On this endpoint /v1/speakers/1/relationships/sessions
Although this endpoint /v1/sessions/1/relationships/speaker
Can anyone point me as to what might be the problem ?
Rest all other endpoints are working fine.
Here is the PR fossasia/open-event-orga-server#3771

Areeb Jamal
@iamareebjamal
Jun 16 2017 20:42
Hey guys. Take a look at this to enforce uniform and best practice commit messages. There are several more coala bears which can be used with gitmate to provide static analysis of code too https://github.com/coala/bear-docs/blob/master/docs/GitCommitBear.rst
Aseem Shrey
@LuD1161
Jun 16 2017 21:13

Hey guys !
Can anyone help me with alembic migrations.
I made a migration file which has op.execute() as well as bind() , I am changing the column name in op.execute() function and then accessing the same table in bind() gives an error.
The code snippet :

~~~ <snip>~~~
 op.execute('ALTER TABLE events RENAME COLUMN has_session_speakers TO has_sessions_speakers')
 op.execute('ALTER TABLE events RENAME COLUMN sponsors_enabled TO is_sponsors_enabled')
~~~ <snip>~~~
    bind = op.get_bind()
    session = Session(bind=bind)
    event = session.query(Event)
    values = [value.show_map for value in event]
    counter = 0
    op.drop_column('events', 'show_map')
    op.add_column('events', sa.Column('is_map_shown', sa.BOOLEAN(), autoincrement=False, default=False))
    for value in event:
        value.state = value.state.lower()
        if values[counter]:
            value.is_map_shown = True
        counter += 1

But I'm getting this error

sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column events.show_map does not exist
LINE 1: ..., events.organizer_name AS events_organizer_name, events.sho...
                                                             ^
 [SQL: 'SELECT events.id AS events_id, events.identifier AS events_identifier, events.name AS events_name, events.event_url AS events_event_url, events.logo_url AS events_logo_url, events.starts_at AS events_starts_at, events.ends_at AS events_ends_at, events.timezone AS events_timezone, events.latitude AS events_latitude, events.longitude AS events_longitude, events.location_name AS events_location_name, events.searchable_location_name AS events_searchable_location_name, events.description AS events_description, events.original_image_url AS events_original_image_url, events.thumbnail_image_url AS events_thumbnail_image_url, events.large_image_url AS events_large_image_url, events.icon_image_url AS events_icon_image_url, events.organizer_name AS events_organizer_name, events.show_map AS events_show_map, events.organizer_description AS events_organizer_description, events.has_sessions_speakers AS events_has_sessions_speakers, events.privacy AS events_privacy, events.state AS events_state, events.type AS events_type, events.topic AS events_topic, events.sub_topic AS events_sub_topic, events.ticket_url AS events_ticket_url, events.code_of_conduct AS events_code_of_conduct, events.schedule_published_on AS events_schedule_published_on, events.is_ticketing_enabled AS events_is_ticketing_enabled, events.deleted_at AS events_deleted_at, events.payment_country AS events_payment_country, events.payment_currency AS events_payment_currency, events.paypal_email AS events_paypal_email, events.is_tax_enabled AS events_is_tax_enabled, events.is_pay_by_paypal AS events_is_pay_by_paypal, events.is_pay_by_stripe AS events_is_pay_by_stripe, events.is_pay_by_cheque AS events_is_pay_by_cheque, events.is_pay_by_bank AS events_is_pay_by_bank, events.pay_onsite AS events_pay_onsite, events.cheque_details AS events_cheque_details, events.bank_details AS events_bank_details, events.onsite_details AS events_onsite_details, events.created_at AS events_created_at, events.pentabarf_url AS events_pentabarf_url, events.ical_url AS events_ical_url, events.xcal_url AS events_xcal_url, events.is_sponsors_enabled AS events_is_sponsors_enabled \nFROM events']

However if I remove the last loop it doesn't give any error.
Any ideas as to why it is happening , I am doubting it to the asynchronous nature of SQLAlchemy. If so then I'm looking for callbacks to drop_column and add_column functions. I think they might help.