Skip to content
This repository has been archived by the owner on May 28, 2022. It is now read-only.

Construct a new database schema for the presentation table that better handles timestamps #667

Open
SRomansky opened this issue Nov 24, 2014 · 4 comments
Labels

Comments

@SRomansky
Copy link
Contributor

The current database schema:

PRESENTATIONS_SCHEMA_310 = '''CREATE TABLE IF NOT EXISTS presentations                                                                                                                           
                                       (Id INTEGER PRIMARY KEY,                                                                                                                                  
                                        Title varchar(255),                                                                                                                                      
                                        Speaker varchar(100),                                                                                                                                    
                                        Description text,                                                                                                                                        
                                        Category varchar(25),                                                                                                                                    
                                        Event varchar(100),                                                                                                                                      
                                        Room varchar(25),                                                                                                                                        
                                        Date timestamp,                                                                                                                                          
                                        StartTime timestamp,                                                                                                                                     
                                        EndTime timestamp,                                                                                                                                       
                                        UNIQUE (Speaker, Title) ON CONFLICT IGNORE)'''

Does not describe the Date, StartTime, or Endtime that Freeseer expects. It would be useful to have a well defined meaning for what each field is supposed to contain.

Some of the current code in Freeseer expects dates of the format 2010-05-14T10:45 and has resulted in the following code being added:

    if not presentation.date and presentation.startTime and len(presentation.startTime) == 16:
            presentation.date, presentation.startTime = presentation.startTime[:-6], presentation.startTime[11:]

Such code would need to be refactored when a new schema was implemented. The above code also uses the same timestamp format for the presentation.date and presentation.startTime fields.

Related #634, #619, #484

@SRomansky
Copy link
Contributor Author

#619 (comment) provides an example of how the ambiguous schema creates a bit of confusion.

@zxiiro
Copy link
Member

zxiiro commented Nov 24, 2014

This is handled by QDateTime / QDate / QTime I can't recall which or if all combinations of those are used but as long as your date format is accepted by those Qt will handle the rest. You can probably look up the Qt Docs on those classes to find out what their requirements are.

@SRomansky
Copy link
Contributor Author

@zxiiro OK. I can dig into that, (I think after #619 and #651 are wrapped up).

@SRomansky
Copy link
Contributor Author

http://www.pythoncentral.io/advanced-sqlite-usage-in-python/ mentions that if we have a timestamp column then we should have a datetime object. I think this person http://www.qtforum.org/article/34211/qsqlquery-sqlite3-timestamp.html shows using the qdatetime object with a timestamp SQLITE column too.

SRomansky pushed a commit to SRomansky/freeseer that referenced this issue Nov 28, 2014
…imestamp

objects.

Replaced references to presentation.{date,startTime,endTime} that use strings
with QDateTime objects.

Modified the rss and csv reading functions to cast the presentation timestamp
fields into QDateTime objects.

Modified the csv and rss exporting functions to cast QDateTime objects into
strings.

Updated several database queries to use Date and DateTime variables instead
of just using DateTime.

Added prepared queries to replace existing queries involving the date. This was
needed since format does not work with a QDateTime object.

fix Freeseer#667
SRomansky pushed a commit to SRomansky/freeseer that referenced this issue Dec 4, 2014
…imestamp

objects.

Replaced references to presentation.{date,startTime,endTime} that use strings
with QDateTime objects.

Modified the rss and csv reading functions to cast the presentation timestamp
fields into QDateTime objects.

Modified the csv and rss exporting functions to cast QDateTime objects into
strings.

Updated several database queries to use Date and DateTime variables instead
of just using DateTime.

Added prepared queries to replace existing queries involving the date. This was
needed since format does not work with a QDateTime object.

fix Freeseer#667
SRomansky pushed a commit to SRomansky/freeseer that referenced this issue Dec 4, 2014
- Remove test methods that only check function return types

- Create resources folder for common test data like test rss feeds

- Fix database.py query bugs

- Add database folder for database related tests

- Refactor common database fixtures into the database conftest file

- Refactor comments in database.py

- Refactor queries in database.py to have better style and sanitization

- Add comments and examples of the presentation time stamps

- Remove unused functions from database.py

- Add httpretty mock tests for database.py

- Add a database schema upgrade test

- Add tests that check multiple scenarios of each method in database.py

- Replace string % operators with calls to format for nonlog string formatting

- Remove several try/finally statements and replaced them with 'with's

- Fix an exception logging statement which referred to an out of scope value

- Add failure and presentation equality and inequality comparison functions

- Add example of parameterized test with fixtures

- Fix relative path bug from linux convention to multi-platform in
  test_rss_feedparser.py

- Add fixtures based on summer camp 2010 and 2011 stored data

- Add rough copy of new schema

Related Freeseer#484
Related Freeseer#651
Related Freeseer#667
Related Freeseer#670
SRomansky pushed a commit to SRomansky/freeseer that referenced this issue Dec 4, 2014
- Remove test methods that only check function return types

- Create resources folder for common test data like test rss feeds

- Fix database.py query bugs

- Add database folder for database related tests

- Refactor common database fixtures into the database conftest file

- Refactor comments in database.py

- Refactor queries in database.py to have better style and sanitization

- Add comments and examples of the presentation time stamps

- Remove unused functions from database.py

- Add httpretty mock tests for database.py

- Add a database schema upgrade test

- Add tests that check multiple scenarios of each method in database.py

- Replace string % operators with calls to format for nonlog string formatting

- Remove several try/finally statements and replaced them with 'with's

- Fix an exception logging statement which referred to an out of scope value

- Add failure and presentation equality and inequality comparison functions

- Add example of parameterized test with fixtures

- Fix relative path bug from linux convention to multi-platform in
  test_rss_feedparser.py

- Add fixtures based on summer camp 2010 and 2011 stored data

- Add rough copy of new schema

Related Freeseer#484
Related Freeseer#667
Related Freeseer#670
SRomansky pushed a commit to SRomansky/freeseer that referenced this issue Dec 18, 2014
- Remove test methods that only check function return types

- Create resources folder for common test data like test rss feeds

- Fix database.py query bugs

- Add database folder for database related tests

- Refactor common database fixtures into the database conftest file

- Refactor comments in database.py

- Refactor queries in database.py to have better style and sanitization

- Add comments and examples of the presentation time stamps

- Remove unused functions from database.py

- Add httpretty mock tests for database.py

- Add a database schema upgrade test

- Add tests that check multiple scenarios of each method in database.py

- Replace string % operators with calls to format for nonlog string formatting

- Remove several try/finally statements and replaced them with 'with's

- Fix an exception logging statement which referred to an out of scope value

- Add failure and presentation equality and inequality comparison functions

- Add example of parameterized test with fixtures

- Fix relative path bug from linux convention to multi-platform in
  test_rss_feedparser.py

- Add fixtures based on summer camp 2010 and 2011 stored data

- Add rough copy of new schema

Related Freeseer#484
Related Freeseer#667
Related Freeseer#670
SRomansky pushed a commit to SRomansky/freeseer that referenced this issue Dec 19, 2014
- Remove test methods that only check function return types

- Create resources folder for common test data like test rss feeds

- Fix database.py query bugs

- Add database folder for database related tests

- Refactor common database fixtures into the database conftest file

- Refactor comments in database.py

- Refactor queries in database.py to have better style and sanitization

- Add comments and examples of the presentation time stamps

- Remove unused functions from database.py

- Add httpretty mock tests for database.py

- Add a database schema upgrade test

- Add tests that check multiple scenarios of each method in database.py

- Replace string % operators with calls to format for nonlog string formatting

- Remove several try/finally statements and replaced them with 'with's

- Fix an exception logging statement which referred to an out of scope value

- Add failure and presentation equality and inequality comparison functions

- Add example of parameterized test with fixtures

- Add fixtures based on summer camp 2010 and 2011 stored data

Related Freeseer#484
Related Freeseer#667
Related Freeseer#670
SRomansky pushed a commit to SRomansky/freeseer that referenced this issue Dec 19, 2014
dideler pushed a commit that referenced this issue Dec 19, 2014
SRomansky pushed a commit to SRomansky/freeseer that referenced this issue Dec 19, 2014
- Remove test methods that only check function return types

- Create resources folder for common test data like test rss feeds

- Fix database.py query bugs

- Add database folder for database related tests

- Refactor common database fixtures into the database conftest file

- Refactor comments in database.py

- Refactor queries in database.py to have better style and sanitization

- Add comments and examples of the presentation time stamps

- Remove unused functions from database.py

- Add httpretty mock tests for database.py

- Add a database schema upgrade test

- Add tests that check multiple scenarios of each method in database.py

- Replace string % operators with calls to format for nonlog string formatting

- Remove several try/finally statements and replaced them with 'with's

- Fix an exception logging statement which referred to an out of scope value

- Add failure and presentation equality and inequality comparison functions

- Add example of parameterized test with fixtures

- Add fixtures based on summer camp 2010 and 2011 stored data

Related Freeseer#484
Related Freeseer#667
Related Freeseer#670
SRomansky pushed a commit to SRomansky/freeseer that referenced this issue Dec 19, 2014
- Remove test methods that only check function return types

- Create resources folder for common test data like test rss feeds

- Fix database.py query bugs

- Add database folder for database related tests

- Refactor common database fixtures into the database conftest file

- Refactor comments in database.py

- Refactor queries in database.py to have better style and sanitization

- Add comments and examples of the presentation time stamps

- Remove unused functions from database.py

- Add httpretty mock tests for database.py

- Add a database schema upgrade test

- Add tests that check multiple scenarios of each method in database.py

- Replace string % operators with calls to format for nonlog string formatting

- Remove several try/finally statements and replaced them with 'with's

- Fix an exception logging statement which referred to an out of scope value

- Add failure and presentation equality and inequality comparison functions

- Add example of parameterized test with fixtures

- Add fixtures based on summer camp 2010 and 2011 stored data

Related Freeseer#484
Related Freeseer#667
Related Freeseer#670
SRomansky pushed a commit to SRomansky/freeseer that referenced this issue Dec 27, 2014
- Remove test methods that only check function return types

- Create resources folder for common test data like test rss feeds

- Fix database.py query bugs

- Add database folder for database related tests

- Refactor common database fixtures into the database conftest file

- Refactor comments in database.py

- Refactor queries in database.py to have better style and sanitization

- Add comments and examples of the presentation time stamps

- Remove unused functions from database.py

- Add httpretty mock tests for database.py

- Add a database schema upgrade test

- Add tests that check multiple scenarios of each method in database.py

- Replace string % operators with calls to format for nonlog string formatting

- Remove several try/finally statements and replaced them with 'with's

- Fix an exception logging statement which referred to an out of scope value

- Add failure and presentation equality and inequality comparison functions

- Add example of parameterized test with fixtures

- Add fixtures based on summer camp 2010 and 2011 stored data

Related Freeseer#484
Related Freeseer#667
Related Freeseer#670
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants