Need help with flags
See original GitHub issueI am trying to use the copy_to() function, and I don’t know how to supply the right values in the “flags” field in preparation of the Column object. Here is my code:
col_brandid = Column(name='BrandId', type=BigIntType, flags=0)
col_lenderid = Column(name='LenderId', type=BigIntType, flags=0)
col_namekey = Column(name='NameKey', type=NVarCharType(size=20), flags=0)
col_namekey2 = Column(name='NameKey2', type=NVarCharType(size=20), flags=0)
col_startdate = Column(name='StartDate', type=SmallDateTimeType, flags=0)
col_enddate = Column(name='EndDate', type=SmallDateTimeType, flags=0)
col_enrollmentcode = Column(name='EnrollmentCode', type=NVarCharType(size=10), flags=0)
col_recordjson = Column(name='RecordJson', type=VarCharMaxType, flags=0)
columns_lst=[col_brandid, col_lenderid, col_namekey, col_namekey2, col_startdate, col_enddate, col_enrollmentcode, col_recordjson]
with open(file_path, "r") as file_stream:
cur.copy_to(file_stream, 'PrescreenRecords_Stage', sep='|', columns=columns_lst)
The error message is:
Traceback (most recent call last):
File "test_df_bulk.py", line 70, in <module>
cur.copy_to(file_stream, 'PrescreenRecords_Stage', sep='|', columns=columns_lst)
File "/home/s_dev_infsvc/.local/lib/python3.6/site-packages/pytds/__init__.py", line 982, in copy_to
for col in metadata)
File "/home/s_dev_infsvc/.local/lib/python3.6/site-packages/pytds/__init__.py", line 982, in <genexpr>
for col in metadata)
TypeError: get_declaration() missing 1 required positional argument: 'self'
I wonder if anyone can show me a few examples to set the right values in the “flags” field?
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Helping With Flags
372 Town Place, Fairview,TX 75069 · 214.383.8012 · info@helpingwithflags.com. Quick Links. Pricing · Request a Demo · Start a Flag Program · Contact...
Read more >Support Flags | 100% Made in USA
Show your support with our 100% Made in USA Support Flags! We offer a wide variety of Military Flags including Army, Navy, Air...
Read more >Flag Advocacy | The American Legion
The American Legion is a great resource for flag etiquette and display questions ; Flag Q&A · Ask our flag expert a questions...
Read more >Help Flag Distress Signal - Survival Frog
Get help fast! When you need to flag down help in an emergency situation, this bright orange distress signal is impossible to ignore....
Read more >Flag Etiquette - VFW
Whether you're looking for the historic details of how the U.S. flag came to be, or the rules ... we're here to ensure...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@j1yuan You should use pytds.tds_types.BigIntType() instead of INT8TYPE, and SmallDateTimeType() instead of DATETIM4TYPE, etc.
@j1yuan if you really want to set the column flags, here is the reference
fNullable is a bit flag. Its value is 1 if the column is nullable.
fNullable is at the least significant position so you may put 0 for NOT NULL, and and identity column is 0 | fIdentity